gmtime_r bug in High Sierra?
gmtime_r bug in High Sierra?
- Subject: gmtime_r bug in High Sierra?
- From: Stephane Sudre <email@hidden>
- Date: Sun, 10 Sep 2017 00:51:39 +0200
Maybe I'm missing something (regarding the tm var) but shouldn't all
the struct tm fields be correctly set by gmtime_r?
#include <unistd.h>
#include <time.h>
#include <string.h>
#include <stdio.h>
int main(int argc, const char * argv[]) {
char tmpc[128];
struct tm tm;
memset(tmpc, 0, sizeof(tmpc));
__darwin_time_t tValue=2914986787602432000;
gmtime_r(&tValue, &tm);
strftime(tmpc, sizeof(tmpc), "%FT%T", &tm);
printf("time: %s\n",tmpc);
printf("-----------------\n");
struct tm tm2;
tm2.tm_mon=10240;
memset(tmpc, 0, sizeof(tmpc));
tValue=2914986787602432000;
gmtime_r(&tValue, &tm2);
strftime(tmpc, sizeof(tmpc), "%FT%T", &tm2);
printf("time: %s\n",tmpc);
return 0;
}
=>
time: 1900-01-00T18:40:00
-----------------
time: 1900-10241-00T18:40:00
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden