We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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.
With summer and winter time, there are closer to 250 time zones in use. I'd say that is quite a big number.
It certainly is. That is why we give the users the option to enter the detail manually (i.e., the raw detail). And being raw, there is a whole lot less. It could be argued that we use an apolitical method of configuration.
The net is absolutely stuffed with work-around code people have had to write to work with time zones on Windows...
That may well be the case. But we don't. We access that timezone database for a given location. It's not at all complicated.
So all data is collected in UTC, and the customers specifies on the server side what TZ they want the information presented in.
Exactly as we do. But, for us, some equipment has to display the local time and/or react for events relative to the local timezone. Having that information is therefore critical.
in which case we supply the standard database package
We prefer to send the raw detail. Certainly for us, we would send the device information about its location anyway, so it might as well just be sent what it really needs.
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