Thank you very much. I would like to test gnc_localtime (and gnc_localtime_r).
For that, I would like to change the timezone. Is there an environmental variable I can define with export of bash ? (sorry for the dupplicate mail to you, John) 2016-02-01 16:36 UTC+01:00, John Ralls <jra...@ceridwen.us>: > >> On Feb 1, 2016, at 1:50 AM, gLETTERyYuMEANSj LETTERyOt >> <gletteryyumeansjletter...@gmail.com> wrote: >> >> Dear everyone, >> >> Can someone help me, by showing the right Gnucash-compatible way to >> recover the >> time difference due to the timezone settings at a given UTC date, in >> C++ and in C? >> >> This is blocking any progress from my part :-/ > > First, think hard about whether you really need that. The gnc_localtime > function will fill in the struct tm correctly for the local timezone with > the correct DST. That's what the date display functions in gnc-date.h use > and you should probably be using them. > > If you're sure that you really need the offset, the best you can do in C is > to call gnc_localtime and gnc_gmtime with the same time64 and get the > difference between the two returned structs tm. It will be corrected for the > In C++ you can include gnc-datetime.hpp and construct a GncDateTime from > your time64 and call its offset() member function. In both cases the result > will be correct for the DST at the time. > > Regards, > John Ralls > > _______________________________________________ gnucash-devel mailing list gnucash-devel@gnucash.org https://lists.gnucash.org/mailman/listinfo/gnucash-devel