Skip to content

Commit

Permalink
Update Vlpp.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
vczh committed Jul 26, 2021
1 parent 8e4d943 commit e831dc3
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions Import/Vlpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,6 @@ DateTime
dt.totalMilliseconds = (vuint64_t)timer * 1000 + milliseconds;
return dt;
}

vint GetCurrentMilliseconds()
{
struct timeval tv;
gettimeofday(&tv, nullptr);
return tv.tv_usec / 1000;
}
#endif

DateTime DateTime::LocalTime()
Expand All @@ -136,9 +129,10 @@ DateTime
GetLocalTime(&systemTime);
return SystemTimeToDateTime(systemTime);
#elif defined VCZH_GCC
time_t timer = time(nullptr);
tm* timeinfo = localtime(&timer);
return ConvertTMToDateTime(timeinfo, GetCurrentMilliseconds());
struct timeval tv;
gettimeofday(&tv, nullptr);
tm* timeinfo = localtime(&tv.tv_sec);
return ConvertTMToDateTime(timeinfo, tv.tv_usec / 1000);
#endif
}

Expand All @@ -149,9 +143,10 @@ DateTime
GetSystemTime(&utcTime);
return SystemTimeToDateTime(utcTime);
#elif defined VCZH_GCC
time_t timer = time(nullptr);
tm* timeinfo = gmtime(&timer);
return ConvertTMToDateTime(timeinfo, GetCurrentMilliseconds());
struct timeval tv;
gettimeofday(&tv, nullptr);
tm* timeinfo = gmtime(&tv.tv_sec);
return ConvertTMToDateTime(timeinfo, tv.tv_usec / 1000);
#endif
}

Expand Down

0 comments on commit e831dc3

Please sign in to comment.