mate-desktop/mate-settings-daemon

Using org.freedesktop.timedate1 to provide datetime settings

yetist opened this issue · 3 comments

The datetime plugin of mate-settings-daemon implements a DBUS service to set the system time / timezone as follows:

$ gdbus introspect --system --dest org.mate.SettingsDaemon.DateTimeMechanism --object-path /
node / {
  interface org.freedesktop.DBus.Introspectable {
    methods:
      Introspect(out s data);
    signals:
    properties:
  };
  interface org.freedesktop.DBus.Properties {
    methods:
      Get(in  s interface,
          in  s propname,
          out v value);
      Set(in  s interface,
          in  s propname,
          in  v value);
      GetAll(in  s interface,
             out a{sv} props);
    signals:
    properties:
  };
  interface org.mate.SettingsDaemon.DateTimeMechanism {
    methods:
      SetHardwareClockUsingUtc(in  b is_using_utc);
      GetHardwareClockUsingUtc(out b is_using_utc);
      AdjustTime(in  x seconds_to_add);
      CanSetTime(out i value);
      SetTime(in  x seconds_since_epoch);
      CanSetTimezone(out i value);
      GetTimezone(out s timezone);
      SetTimezone(in  s zonefile);
    signals:
    properties:
  };
};

Systemd also implements a DBUS service to set up the system time as follows:

$ gdbus introspect --system --dest org.freedesktop.timedate1 --object-path /org/freedesktop/timedate1
node /org/freedesktop/timedate1 {
  interface org.freedesktop.DBus.Peer {
    methods:
      Ping();
      GetMachineId(out s machine_uuid);
    signals:
    properties:
  };
  interface org.freedesktop.DBus.Introspectable {
    methods:
      Introspect(out s data);
    signals:
    properties:
  };
  interface org.freedesktop.DBus.Properties {
    methods:
      Get(in  s interface,
          in  s property,
          out v value);
      GetAll(in  s interface,
             out a{sv} properties);
      Set(in  s interface,
          in  s property,
          in  v value);
    signals:
      PropertiesChanged(s interface,
                        a{sv} changed_properties,
                        as invalidated_properties);
    properties:
  };
  interface org.freedesktop.timedate1 {
    methods:
      SetTime(in  x arg_0,
              in  b arg_1,
              in  b arg_2);
      SetTimezone(in  s arg_0,
                  in  b arg_1);
      SetLocalRTC(in  b arg_0,
                  in  b arg_1,
                  in  b arg_2);
      SetNTP(in  b arg_0,
             in  b arg_1);
    signals:
    properties:
      readonly s Timezone = 'Asia/Shanghai';
      readonly b LocalRTC = false;
      @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
      readonly b CanNTP = true;
      readonly b NTP = true;
      @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
      readonly b NTPSynchronized = true;
      @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
      readonly t TimeUSec = 1528342832113233;
      @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
      readonly t RTCTimeUSec = 1528342832000000;
  };
};

They provide the same function. Maybe we should use org.freedesktop.timedate1 dbus interface directly?

I think there are people who don't use systemd, but for the majority of distros/users it should be OK or better to use systemd directly, imho.
Maybe with a condition?

mate-settings-daemon 1.24.0 throw up what appears to be associated with systemd on my non-systemd Linux system when I try to access the time date function!

time-date