Giuseppe Modugno

newlib: how to set local timezone for localtime()

Discussion created by Giuseppe Modugno on Mar 30, 2018

I have an UTC time (seconds since epoch) received from a NTP server. I need to convert it to broken-down local time.

I know I can use localtime(), but it returns the UTC broken-down time. I think because no timezone is configured.

I'm using MCUXpresso IDE and newlib-nano libraries.

 

Now the question: I can configure the timezone that must be used during localtime() conversion? In my case, it is Italy timezone. Of course, the daylight should be taken into account.

Outcomes