20 C
New York
Wednesday, June 18, 2025

How one can set a customized timezone offset in Sonoma?


I need to set my clock 5 minutes sooner than precise time. A technique to do this is to show of set time robotically 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 accurately attributable to 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 legitimate TZinf file.

$ file Asia/Kolkata+05
Asia/Kolkata+05: timezone information (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 not try this as I’m on a piece laptop computer.

$ sudo systemsetup -settimezone ~/Asia/Kolkata+05
/Customers/karan/Asia/Kolkata+05 shouldn't be a legitimate 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 so forth/localtime

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles