I want to set my clock 5 minutes faster than actual time. One way to do that is to turn of set time automatically and manually set the time.
But this way the time is incorrect doing
date +%s
will give incorrect timestamps. Also some websites and applications don't function correctly due to this like TOTP.
So then I tried setting a custom timezone offset with zic from https://github.com/eggert/tz .
$ echo "Zone Asia/Kolkata+05 5:35 - IST+05" | zic -b fat -d . -
This gave me a valid TZinf file.
$ file Asia/Kolkata+05
Asia/Kolkata+05: timezone data (fat), version 2, no gmt time flags, no std time flags, no leap seconds, no transition times, 1 local time type, 7 abbreviation chars
I tried setting timezone with systemsetup but it isn't allowing this timezone. Chatgpt suggest turning off SIP and moving the file but I cannot do that as I am on a work laptop.
$ sudo systemsetup -settimezone ~/Asia/Kolkata+05
/Users/karan/Asia/Kolkata+05 is not a valid timezone. The command 'listtimezones' will show a list of valid 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 but I want to see system time with this offset.
$ export TZ="/Users/karan/Asia/Kolkata+05"
$ date
Wed Dec 25 03:42:09 IST+05 2024
$ gdate
Wed Dec 25 03:42:15 IST+05 2024
Also tried symlinking to localtime but it resets timezone to pacific time.
sudo ln -sf ~/Asia/Kolkata+05 /etc/localtime
Asked by Karan Yadav
(1 rep)
Dec 24, 2024, 10:10 PM
Last activity: Dec 24, 2024, 10:12 PM
Last activity: Dec 24, 2024, 10:12 PM