[OpenIndiana-discuss] This doesn't seem right

Gary Gendel gary at genashor.com
Fri Dec 9 19:50:42 UTC 2011


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);
   return 0;
}

What am I missing?

Gary




More information about the OpenIndiana-discuss mailing list