Am 01.04.2018 um 12:01 schrieb Dimiter_Popoff:> And that new IANA timezone database seems to be the answer, I'll > look into it.The only thing that's new about that is the "IANA" part. Paul Eggert has been maintaining the actual database in the public domain for a bit over 30 years now.
firstname.lastname@example.org wrote:> On Fri, 30 Mar 2018 17:46:57 +0200, pozz <email@example.com> wrote: > > > > [...] > > My C libraries are newlib and I suspect newlib thinks the timezone is > > UTC without daylight savings. > > > > Now the question is: how to configure newlib libraries to use a specific > > timezone (Italy, in my case) so localtime() works as expected? > > In MS-DOS you could say > > SET TZ=EET-2EES-3,M3.5.0/02:00,M10.5.0/03:00POSIX specifies the content of the TZ variable here: <http://pubs.opengroup.org/onlinepubs/9699919799.2008edition/basedefs/V1_chap08.html#tag_08_03>
>I correctly receive current time (seconds from epoch) in UTC. Now I >would like to convert it in struct tm *localtime*. >There's localtime() function that is what I tried to call. However, as >expected, localtime() returns UTC. > >My C libraries are newlib and I suspect newlib thinks the timezone is >UTC without daylight savings. > >Now the question is: how to configure newlib libraries to use a specific>timezone (Italy, in my case) so localtime() works as expected?I recently described my approach to calculating DST based on a local clock chip. Parameters that you would feed in would be the generic date of spring forward (for example 3rd sunday of May) and fall back (like first Sunday in November). I am not sure if you were looking for an automated method of adjusting DST based on geographical location, but if you or the user are prepared to set up the generic change dates (keep in mind these can change as happened in the USA 3 or 4 years ago), then perhaps my code could be of some help. See //www.eeweb.com/profile/aubrey-kagan/articles/correcting-for-daylight-savings-time --------------------------------------- Posted through http://www.EmbeddedRelated.com