mate-desktop / mate-settings-daemon

MATE settings daemon
https://mate-desktop.org
GNU General Public License v2.0
43 stars 47 forks source link

Using org.freedesktop.timedate1 to provide datetime settings #228

Open yetist opened 6 years ago

yetist commented 6 years ago

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?

raveit65 commented 6 years ago

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?

alexarnaud commented 6 years ago

Le 07/06/2018 à 10:24, raveit65 a écrit :

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?

I assume people using BSDs systems don't have systemd so if we would like to be usable for all we don't have the choice to keep the old function as fallback if systemd is not available.

Best regards, Alex.

texstar commented 4 years ago

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