Closed Cyrillius closed 7 years ago
same thing for tm_zone and tm_gmtoff;
I can give you the actual offset
void setToLocalTz(struct tm* date){
time_t now = time(0);
struct tm* local_date = localtime(&now);
date->tm_zone = local_date->tm_zone;
date->tm_isdst = local_date->tm_isdst;
date->tm_gmtoff = local_date->tm_gmtoff;
}
Is also gmtime (the inverse of timegm) only available in Linux OS ?
Ok, Into the watch there is no operating system (OS) . Therefore the standard library doesn't know what is the current UTC time. I can give you in the function parameter a pointer to the actual UTC time.
I replaced all timegm with localtime and gmtime with mktime. However, you need to set TZ to UTC in order to get correct results: 81ad812344abb52a9d732104c8d2ae80d0a1a0af
@radcheb Be careful, the timegm function is only available on a linux OS. I can give you a time_t struct with the UTC time.