NTP - Laptop (WLAN) - suspend/resume - time-keeping consistency

Yes, I know NTP on a Laptop but, due to their portability Laptops are often used for data gathering and therefore often need accurate timestamps.
[HR][/HR]Has anyone else noticed that, if a machine with NTP active is suspended, when it’s resumed the NTP clocks are often no longer accurate?
[HR][/HR]My personal solution to date is as follows:

  • In /usr/lib/systemd/system-sleep/ place an executable file such as ‘manage-services.sh’ with content as follows:

#!/bin/bash
#
# manage-services.sh
#
# With openSUSE Leap 42.1 (Malachite) Linux 4.1.21-14-default
# with respect to NTP still needed . . .
#
if  "$1" = "pre" ]; then
    logger "manage-services.sh: Entering systemd-"$2""
    /usr/bin/systemctl stop ntpd.service
fi
if  "$1" = "post" ]; then
    logger "manage-services.sh: Leaving systemd-"$2""
#     /usr/bin/systemctl restart systemd-udevd
#     /usr/bin/systemctl restart udisks2.service
#     /usr/bin/systemctl restart autofs.service
    /usr/bin/systemctl start ntpd.service
fi

[HR][/HR]Any other ideas for a solution of this issue?*

I’ve posted about this in the Virtualization forums (don’t remember if I also submitted a bug, I think I did about a year ago), suspending a VM probably is similar to placing a machine on standby.

I think your script does little more than just manually executing an ntpd service restart as follows :slight_smile:

systemctl restart ntpd.service

Yes, I make it a habit so I don’t rely on an automatic solution…
The alternative probably is to sync with the system machine clock, but it won’t be guaranteed accurate across a network so sync-ing with ntpd (Domain or Internet) should be preferred.

TSU