[OpenIndiana-discuss] This doesn't seem right
Gary Gendel
gary at genashor.com
Fri Dec 9 19:54:16 UTC 2011
Sorry for the repeat. I forgot to add the print statement:
It looks like either gmtime or strftime is not functioning as I expect.
In the following program, I always get the local time instead of UTC.
#include <time.h>
#include <stdio.h>
int main()
{
char datebuf[64];
time_t now = time(0);
struct tm *tm = gmtime(&now);
strftime(datebuf, sizeof datebuf - 1, "%d %b %Y %H:%M:%S %z", tm);
printf("%s\n", datebuf);
return 0;
}
What am I missing?
Gary
More information about the OpenIndiana-discuss
mailing list