[systemd-devel] How to set time from Perl

Manuel Reimer Manuel.Spam at nurfuerspam.de
Mon Sep 7 07:23:42 PDT 2015


Hello,

if I run the following code on an intel based platform, then I don't 
have any problems:

   use Net::DBus;
   my $bus = Net::DBus->system();
   my $logind = $bus->get_service('org.freedesktop.timedate1');
   my $manager = $logind->get_object('/org/freedesktop/timedate1',
                                     'org.freedesktop.timedate1');
   $manager->SetTime($time * 1000000, 0, 0);

The variable "$time" is in seconds.

If I run this to an ARM based system, then I get the folowing time:

   # date
   Thu Jan  1 01:00:02 CET 1970

Does someone have an idea why this doesn't work?

Is there any alternative to set the time easily? As far as I see 
timedatectl doesn't allow me to use just seconds and doesn't allow to 
set time based on an UTC timestamp.

Thanks in advance.

Manuel



More information about the systemd-devel mailing list