Wednesday, December 25, 2024

Methods to set a customized timezone offset in Sonoma?

I need to set my clock 5 minutes quicker than precise time. A technique to do this is to show of set time routinely and manually set the time.

However this manner the time is wrong doing date +%s will give incorrect timestamps. Additionally some web sites and functions do not operate appropriately as a consequence of this like TOTP.

So then I attempted setting a customized timezone offset with zic from https://github.com/eggert/tz.

$ echo "Zone    Asia/Kolkata+05    5:35    -    IST+05" | zic -b fats -d . -

This gave me a sound TZinf file.

$ file Asia/Kolkata+05
Asia/Kolkata+05: timezone knowledge (fats), model 2, no gmt time flags, no std time flags, no leap seconds, no transition occasions, 1 native time kind, 7 abbreviation chars

I attempted setting timezone with systemsetup however it is not permitting this timezone. Chatgpt recommend turning off SIP and transferring the file however I can’t do this as I’m on a piece laptop computer.

$ sudo systemsetup -settimezone ~/Asia/Kolkata+05
/Customers/karan/Asia/Kolkata+05 will not be a sound timezone. The command 'listtimezones' will present an inventory of legitimate time zones.

$ sudo cp Asia/Kolkata+05 /usr/share/zoneinfo/Asia/
cp: /usr/share/zoneinfo/Asia/Kolkata+05: Operation not permitted

Exporting TZ variable to this timezone works with date and gdate utilities however I need to see system time with this offset.

$ export TZ="/Customers/karan/Asia/Kolkata+05"
$ date
Wed Dec 25 03:42:09 IST+05 2024
$ gdate
Wed Dec 25 03:42:15 IST+05 2024

Additionally tried symlinking to localtime however it resets timezone to pacific time.

sudo ln -sf ~/Asia/Kolkata+05 /and many others/localtime

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles