[Solved] On the Pi the Time.zone not working

Setting the Time.zone on the Pi has no effect. A time number displays as UTC, no zone adjustment.

My bad! Time.zone() is working on the Pi, it’s just that you don’t need it, the Pi clock is already set for the proper timezone and Time.zone() actually backs that up by 5 hours for my eastern timezone.

Just side note, that really I need to move to Raspberry Pi, but setting the Time.zone on the Pi has no effect. A time number displays as UTC, no zone adjustment.

I think that's the common behaviour.
If you want a localized version of the epoch time, you'd use Time.local() instead of Time.now().
As Time.now() will always (irrespective of your Time.zone() setting) return the seconds since 1.1.1970 00:00 UTC.
Time.now() in turn will return seconds since 1.1.1970 00:00 in your set time zone.

But all other functions (e.g. hour(), timeStr(), format()) expect a UTC based time to give you a correct result, since the localization happens internally.


ScruffR:
I moved the unlrelated double post of this out of the other thread, to keep things "sorted".

1 Like