Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.arch.embedded > #27694

Re: Convert NTP UTC time to localtime (newlib)

Subject Re: Convert NTP UTC time to localtime (newlib)
Newsgroups comp.arch.embedded
References <p9lm5e$jn$1@dont-email.me>
From Clifford Heath <no.spam@please.net>
Message-ID <ffyvC.7086$bz1.80@fx01.iad> (permalink)
Date 2018-03-31 08:46 +1100

Show all headers | View raw


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.

Back to comp.arch.embedded | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


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