-
-
Save nick-desteffen/1126771 to your computer and use it in GitHub Desktop.
sudo ln -sf /usr/share/zoneinfo/UTC /etc/localtime |
Command To See What Your Local Time Is Currently Set To:
[$]> ls -la /etc/localtime
/etc/localtime -> /var/db/timezone/zoneinfo/America/Los_Angeles
Command To Set Your Local Time To UTC
[$]> sudo ln -sf /usr/share/zoneinfo/UTC /etc/localtime
NOTE: When I Set It To UTC - United Kingdom
Via System Preferences It Becomes:
[$]> ls -la /etc/localtime
/etc/localtime -> /var/db/timezone/zoneinfo/UTC
Command To Switch Your Local Time Back To The Original Time Zone
[$]> sudo ln -sf /var/db/timezone/zoneinfo/America/Los_Angeles /etc/localtime
FYI: I Compared Both Of The UTC Files And They Are Exactly Matching
[$]> delta /usr/share/zoneinfo/UTC /var/db/timezone/zoneinfo/UTC
or
[$]> diff /usr/share/zoneinfo/UTC /var/db/timezone/zoneinfo/UTC
[$]> cat /usr/share/zoneinfo/UTC /var/db/timezone/zoneinfo/UTC
TZif2UTCTZif2UTC
UTC0
TZif2UTCTZif2UTC
UTC0
I created the following shell aliases to make switching timezones easy.
# output the current timezone
alias timezone.current='exa -l /etc/localtime'
# set the timezone to my default local timezone
alias timezone.default='sudo ln -sf /var/db/timezone/zoneinfo/America/Los_Angeles /etc/localtime'
# set the timezone to utc
alias timezone.utc='sudo ln -sf /var/db/timezone/zoneinfo/UTC /etc/localtime'
works on MacOs Mojave thanks !
any tip to revert this (in case i need to in the future)