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


_______________________________________________
OpenIndiana-discuss mailing list
[email protected]
http://openindiana.org/mailman/listinfo/openindiana-discuss

Reply via email to