>>>>> "website" == website reader <[email protected]> writes:

website> The time_t unix_seconds = mktime(struct tm calendar) and the
website> struct tm calendar = *localtime(time_t unix_seconds) are nice
website> inverses of each other, but what do you do for UTC time?

website> I don't want to set the local timezone of my PC to UTC for
website> mktime() to get it right and have unix_seconds agree with the
website> local clock_gettime() system time tv_sec value.  mktime
website> doesn't work right, when you feed it a struct tm calendar
website> built from gmtime() call.  Or did someone write a nice
website> utcmktime() function?

In addition to the suggestion Galen points at, you can override the
timezone temporarily at the commandline with the TZ environment
variable. E.g.:

  russell@mosier:~$ date
  Wed Mar 13 11:26:19 PDT 2013
  russell@mosier:~$ TZ=UTC date
  Wed Mar 13 18:26:26 UTC 2013
  russell@mosier:~$ TZ="Hongkong" date
  Thu Mar 14 02:27:51 HKT 2013

(for other timezone options, see, e.g. /usr/share/zoneinfo)


-- 
Russell Senior, President
[email protected]
_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug

Reply via email to