Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.arch.embedded > #27695
| From | Dimiter_Popoff <dp@tgi-sci.com> |
|---|---|
| Newsgroups | comp.arch.embedded |
| Subject | Re: Convert NTP UTC time to localtime (newlib) |
| Date | 2018-03-31 15:34 +0300 |
| Organization | TGI |
| Message-ID | <p9nv7n$rfk$1@dont-email.me> (permalink) |
| References | <p9lm5e$jn$1@dont-email.me> <ffyvC.7086$bz1.80@fx01.iad> |
On 31.3.2018 г. 00:46, Clifford Heath wrote: > On 31/03/18 02:46, pozz wrote: >> My platform is an NXP MCU Cortex-M3 running an SNTP client on top of >> lwip TCP/IP stack. >> >> 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 can't tell you about newlib, but *nix systems look at the TZ > environment variable. Sydney is currently EDT-11, tomorrow EST-10. Do you (or anyone) know of a decent standardized way to locate timezone offsets as they change for summer time (or whatever)? I remember googling 2-3 years ago and found nothing I'd then call "reasonable" (don't remember at all why and what I did find, if anything). At the moment I consider preparing a static file predicting the timezones for a few years ahead and ship that with the OS as it comes from us. Then dps can look for an update of this file from time to time. Have not done it yet because it looks a bulky thing to put together, will cost me a whole day if not more. Dimiter ====================================================== Dimiter Popoff, TGI http://www.tgi-sci.com ====================================================== http://www.flickr.com/photos/didi_tgi/
Back to comp.arch.embedded | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Convert NTP UTC time to localtime (newlib) pozz <pozzugno@gmail.com> - 2018-03-30 17:46 +0200
Re: Convert NTP UTC time to localtime (newlib) Clifford Heath <no.spam@please.net> - 2018-03-31 08:46 +1100
Re: Convert NTP UTC time to localtime (newlib) Dimiter_Popoff <dp@tgi-sci.com> - 2018-03-31 15:34 +0300
Re: Convert NTP UTC time to localtime (newlib) Theo <theom+news@chiark.greenend.org.uk> - 2018-03-31 23:37 +0100
Re: Convert NTP UTC time to localtime (newlib) Dimiter_Popoff <dp@tgi-sci.com> - 2018-04-01 12:46 +0300
Re: Convert NTP UTC time to localtime (newlib) Clifford Heath <no.spam@please.net> - 2018-04-01 19:56 +1000
Re: Convert NTP UTC time to localtime (newlib) Dimiter_Popoff <dp@tgi-sci.com> - 2018-04-01 13:03 +0300
Re: Convert NTP UTC time to localtime (newlib) Clifford Heath <no.spam@please.net> - 2018-04-01 19:47 +1000
Re: Convert NTP UTC time to localtime (newlib) Dimiter_Popoff <dp@tgi-sci.com> - 2018-04-01 13:01 +0300
Re: Convert NTP UTC time to localtime (newlib) Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2018-04-01 13:30 +0200
Re: Convert NTP UTC time to localtime (newlib) upsidedown@downunder.com - 2018-03-31 17:19 +0300
Re: Convert NTP UTC time to localtime (newlib) Michael Bäuerle <michael.baeuerle@stz-e.de> - 2018-04-03 10:35 +0200
Re: Convert NTP UTC time to localtime (newlib) "antedeluvian" <63015@EmbeddedRelated> - 2018-04-30 11:18 -0500
csiph-web