Subject: Re: bug#33685: Time settings does not work in gnome

From: Timothy Sample <[email-masked]>
Date: Fri, 19 Jul 2019 17:30:18 -0400

Hello,

Chris Marusich <[email-masked]> writes:

> [email-masked] writes:
>
>> On 2018-12-09 13:06, [email-masked] wrote:
>>> When I set the time or toggle automatic time in the gnome-control-center
>>> it errors out. The time is still wrong.
>>> 
>>> sdb@antelope ~$ gnome-control-center 
>>> 
>>> (gnome-control-center:1556): datetime-cc-panel-WARNING **: 13:24:15.745:
>>> Timezone '(null)' is unhandled, setting Europe/London as default
>>> 
>>> (gnome-control-center:1556): datetime-cc-panel-WARNING **: 13:24:24.324:
>>> Could not set system to use NTP:
>>> GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name
>>> org.freedesktop.timedate1 was not provided by any .service files
>>> 
>>> (gnome-control-center:1556): GLib-GIO-CRITICAL **: 13:24:34.673:
>>> g_dbus_connection_call_internal: assertion 'object_path != NULL &&
>>> g_variant_is_object_path (object_path)' failed
>>> 
>>> [...]

I just came across this, and it’s broken because we do not provide a
“timedate1” D-Bus service.  Usually, this is something systemd provides.
We have a stand-in for its cousin, “locale1”, but not “timedate1”.
Unless we provide the service somehow (another fork of systemd or a
complicated package like “localed”), GNOME Control Center is not going
to work here.

>>
>> Fixed the time manually with 
>> sudo date -s  1308 +%H%M
>> (the date and year was correct already)
>
> Are you using GuixSD?  If so, is your system time set correctly when you
> specify the correct timezone in your operating system configuration
> file, reconfigure the system with "guix system reconfigure", and reboot?
>
> If you're using GuixSD, is your system configured to use the NTP
> service?  It's included by default in the %desktop-services.
>
> I'm not sure what's going on with gnome-control-center, but what I'm
> getting at is that you might not need to use gnome-control-center to set
> the time if you've configured your OS to use NTP and an appropriate
> timezone.

This is a good point.  Even if we did pull “timedated” out of systemd,
what would it do when someone calls “SetTimezone”?  Update the files in
/etc so that they can be reverted at the next reconfigure?

Actually, maybe!

This would be one way to let GNOME’s “automatic timezone” feature work.
It could figure out where you are, send a message to the “timedate1”
service, which in turn would update the ephemeral timezone settings.  It
doesn’t really matter that your timezone is reset by a reconfigure,
because there’s a daemon running that will fix it for you.

That being said, it would be confusing to set the timezone from GNOME
only to have it revert on reconfigure.  (This is what it does now, but
at least it reverts immediately).

Basically, this could be fixed by providing a “timedate1” service, but
it would have some rough edges.

-- Tim