1

I have my date and time settings set to use the "automatic time zone" and that is reflected in timedatectl:

amanda@rajje:~$ timedatectl status
                      Local time: Fri 2019-11-15 14:01:29 EST
                  Universal time: Fri 2019-11-15 19:01:29 UTC
                        RTC time: Fri 2019-11-15 19:01:29
                       Time zone: America/New_York (EST, -0500)
       System clock synchronized: yes
systemd-timesyncd.service active: yes
                 RTC in local TZ: no

But it doesn't update itself. Today I turned on my laptop, connected to a brand new coffee shop internet wifi that is definitely in California, aka America/Los_Angeles (PST, -0800) but I'm still seeing EST on my system clock. I've traveled a bunch over the last few months and my laptop consistently does not updated the timezone.

I know that at least my browser knows where I am because Google Maps defaults to the neighborhood I'm in. So the problem isn't that I'm using an internet connection that's hiding my location.

I thought that sudo systemctl restart systemd-timedated would do it, but that has no effect.

I can quickly change the time zone with timedatectl set-timezone America/New_York or timedatectl set-timezone America/Los_Angeles but I'm wondering if there's a way to use timedatectl or another tool to just tell Ubuntu to figure out what time zone I'm in. A sort of "I'm pretty sure that's wrong, could you check again?" trigger or command?

Amanda
  • 9,051
  • 17
  • 53
  • 98
  • https://askubuntu.com/a/1032021/197910 advises _For Ubuntu 18.04+ make sure Settings -> Privacy -> Location Services is set to "On."_ – K7AAY Nov 15 '19 at 19:57
  • Bingo. I did search for the answer first but didn't find that question somehow. Indeed, my privacy settings have location off. I might leave it off but at least I know why it isn't updating. – Amanda Nov 22 '19 at 01:10

1 Answers1

1
curl "http://worldtimeapi.org/api/ip"

That will return a json data blob like:

{
  "week_number": 46,
  "utc_offset": "-08:00",
  "utc_datetime": "2019-11-15T20:30:02.492900+00:00",
  "unixtime": 1573849802,
  "timezone": "America/Los_Angeles",
  "raw_offset": -28800,
  "dst_until": null,
  "dst_offset": 0,
  "dst_from": null,
  "dst": false,
  "day_of_year": 319,
  "day_of_week": 5,
  "datetime": "2019-11-15T12:30:02.492900-08:00",
  "client_ip": "******",
  "abbreviation": "PST"
}

Read more about the API here: http://worldtimeapi.org/