mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-14 18:15:28 -04:00
Remove unused DateTime_CurrentUTC
This commit is contained in:
parent
a3ffdfb284
commit
4df557dbdd
@ -235,26 +235,16 @@ TimeMS DateTime_CurrentUTC_MS(void) {
|
||||
return FileTime_TotalMS(raw);
|
||||
}
|
||||
|
||||
static void Platform_FromSysTime(struct DateTime* time, SYSTEMTIME* sysTime) {
|
||||
time->year = sysTime->wYear;
|
||||
time->month = sysTime->wMonth;
|
||||
time->day = sysTime->wDay;
|
||||
time->hour = sysTime->wHour;
|
||||
time->minute = sysTime->wMinute;
|
||||
time->second = sysTime->wSecond;
|
||||
time->milli = sysTime->wMilliseconds;
|
||||
}
|
||||
|
||||
void DateTime_CurrentUTC(struct DateTime* time) {
|
||||
SYSTEMTIME utcTime;
|
||||
GetSystemTime(&utcTime);
|
||||
Platform_FromSysTime(time, &utcTime);
|
||||
}
|
||||
|
||||
void DateTime_CurrentLocal(struct DateTime* time) {
|
||||
void DateTime_CurrentLocal(struct DateTime* t) {
|
||||
SYSTEMTIME localTime;
|
||||
GetLocalTime(&localTime);
|
||||
Platform_FromSysTime(time, &localTime);
|
||||
|
||||
t->year = localTime.wYear;
|
||||
t->month = localTime.wMonth;
|
||||
t->day = localTime.wDay;
|
||||
t->hour = localTime.wHour;
|
||||
t->minute = localTime.wMinute;
|
||||
t->second = localTime.wSecond;
|
||||
}
|
||||
|
||||
static cc_bool sw_highRes;
|
||||
@ -296,35 +286,18 @@ TimeMS DateTime_CurrentUTC_MS(void) {
|
||||
return UnixTime_TotalMS(cur);
|
||||
}
|
||||
|
||||
static void Platform_FromSysTime(struct DateTime* time, struct tm* sysTime) {
|
||||
time->year = sysTime->tm_year + 1900;
|
||||
time->month = sysTime->tm_mon + 1;
|
||||
time->day = sysTime->tm_mday;
|
||||
time->hour = sysTime->tm_hour;
|
||||
time->minute = sysTime->tm_min;
|
||||
time->second = sysTime->tm_sec;
|
||||
}
|
||||
|
||||
void DateTime_CurrentUTC(struct DateTime* time_) {
|
||||
struct timeval cur;
|
||||
struct tm utc_time;
|
||||
|
||||
gettimeofday(&cur, NULL);
|
||||
gmtime_r(&cur.tv_sec, &utc_time);
|
||||
|
||||
Platform_FromSysTime(time_, &utc_time);
|
||||
time_->milli = cur.tv_usec / 1000;
|
||||
}
|
||||
|
||||
void DateTime_CurrentLocal(struct DateTime* time_) {
|
||||
void DateTime_CurrentLocal(struct DateTime* t) {
|
||||
struct timeval cur;
|
||||
struct tm loc_time;
|
||||
|
||||
gettimeofday(&cur, NULL);
|
||||
localtime_r(&cur.tv_sec, &loc_time);
|
||||
|
||||
Platform_FromSysTime(time_, &loc_time);
|
||||
time_->milli = cur.tv_usec / 1000;
|
||||
t->year = loc_time.tm_year + 1900;
|
||||
t->month = loc_time.tm_mon + 1;
|
||||
t->day = loc_time.tm_mday;
|
||||
t->hour = loc_time.tm_hour;
|
||||
t->minute = loc_time.tm_min;
|
||||
t->second = loc_time.tm_sec;
|
||||
}
|
||||
|
||||
#define NS_PER_SEC 1000000000ULL
|
||||
|
@ -114,11 +114,8 @@ void Platform_Log4(const char* format, const void* a1, const void* a2, const voi
|
||||
|
||||
/* Returns the current UTC time, as number of milliseconds since 1/1/0001 */
|
||||
CC_API TimeMS DateTime_CurrentUTC_MS(void);
|
||||
/* Returns the current UTC Time. */
|
||||
/* NOTE: Generally DateTime_CurrentUTC_MS should be used instead. */
|
||||
CC_API void DateTime_CurrentUTC(struct DateTime* time);
|
||||
/* Returns the current local Time. */
|
||||
CC_API void DateTime_CurrentLocal(struct DateTime* time);
|
||||
CC_API void DateTime_CurrentLocal(struct DateTime* t);
|
||||
/* Takes a platform-specific stopwatch measurement. */
|
||||
/* NOTE: The value returned is platform-specific - do NOT try to interpret the value. */
|
||||
CC_API cc_uint64 Stopwatch_Measure(void);
|
||||
|
@ -7,8 +7,8 @@
|
||||
*/
|
||||
|
||||
/* Represents a particular instance in time in some timezone. Not necessarily UTC time. */
|
||||
/* NOTE: It is far more efficient to use TimeMS and DateTime_CurrentUTC_MS(). */
|
||||
/* This should only be used when atually needed. (e.g. log mesage time) */
|
||||
/* NOTE: TimeMS and DateTime_CurrentUTC_MS() should almost always be used instead. */
|
||||
/* This should only be used when actually needed. (e.g. log mesage time) */
|
||||
struct DateTime {
|
||||
int year; /* Year, ranges from 0 to 65535 */
|
||||
int month; /* Month, ranges from 1 to 12 */
|
||||
@ -16,7 +16,7 @@ struct DateTime {
|
||||
int hour; /* Hour, ranges from 0 to 23 */
|
||||
int minute; /* Minute, ranges from 0 to 59 */
|
||||
int second; /* Second, ranges from 0 to 59 */
|
||||
int milli; /* Milliseconds, ranges from 0 to 999 */
|
||||
int __milli;/* Was milliseconds, unused now */
|
||||
};
|
||||
|
||||
#define MILLIS_PER_SEC 1000
|
||||
|
Loading…
x
Reference in New Issue
Block a user