You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 6, 2024. It is now read-only.
Currently, Time.now.local converts the UTC to CEST which is local for Denmark only. For people from other countries, to use the toit script, an inbuild timezone function could do good.
I wrote a code to convert from UTC to IST (Indian Standard Time).
import core.time_impl show set_tz_
main:
// Valid TZ values can be easily obtained by looking at the last line of the
// zoneinfo files on Linux machines:
// ```
// tail -n1 /usr/share/zoneinfo/Europe/Copenhagen
// ```
// Alternatively, the following link seems to have some common timezones:
// https://sites.google.com/a/usapiens.com/opnode/time-zones
set_tz_ "CET-1CEST,M3.5.0,M10.5.0/3"
print Time.now.local
This hack uses a private function and is thus not guaranteed to continue to work, but it updates the internal TZ settings to the timezone of your choice.
Note that this call affects all apps on the device.
Also: avoid changing the TZ too often. There is a known memory-leak if the variable is changed too often.
Currently, Time.now.local converts the UTC to CEST which is local for Denmark only. For people from other countries, to use the toit script, an inbuild timezone function could do good.
I wrote a code to convert from UTC to IST (Indian Standard Time).
I have only started with toit, hoping to learn and make great projects out of it.
The text was updated successfully, but these errors were encountered: