This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

"localtime" library function vs local timezone

I am currently trying to convert a unix/epoch time (time_t type) to the local timezone's time using the localtime library function. The conversion from the time_t type to the tm structure type works well using this function, but the converted time is referenced to GMT.

Comments in time.h would make one believe that it should be possible to convert to the local timezone's time:

   /*
    * converts the calendar time pointed to by timer into a broken-down time,
    * expressed a local time.
    * Returns: a pointer to that object.
    */

I have tried to find a way to configure the local timezone, but have been unsuccessful up to now.

Would anyone happen to know if it is feasible to configure the timezone that the library uses, and if so, how this would be done.

I am thanking you in advance for your help.

Parents
  • You can use the time on the U.S.N.O. Master Clock to determine how many hours different your local time is from Universal Time. Once noted, use this number to convert all eclipse prediction times from UT to your own local time.

    For example, if you are in the Eastern Standard Time zone, you will see that your local time is 5 hours earlier than UT. In order to convert any eclipse predictions from UT to local time (i.e. - EST), you must subtract 5 hours from UT:

    Local Time = UT - 5 hours

Reply
  • You can use the time on the U.S.N.O. Master Clock to determine how many hours different your local time is from Universal Time. Once noted, use this number to convert all eclipse prediction times from UT to your own local time.

    For example, if you are in the Eastern Standard Time zone, you will see that your local time is 5 hours earlier than UT. In order to convert any eclipse predictions from UT to local time (i.e. - EST), you must subtract 5 hours from UT:

    Local Time = UT - 5 hours

Children
No data