Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
12
votes
7
answers
56949
views
How to get system time with microsecond Resolution
I want to know current system time with microsecond Resolution. `date +%s` returns Time in seconds since epoch(1-1-1970). How can I get time in microseconds Resolution. How much delay is in querying this value? By delay I mean suppose at time `t` secs i query and it gives me value `t + t'` what is `...
I want to know current system time with microsecond Resolution.
My Use case: I am recording Videos using multiple Raspberry Pis simulatenously. Now I want to timestamp each frame of videos so that I can align them. Currently for timestamp it's using boot time(time since boot). Boot time is accurate but it's different for each Raspberry Pi. I have configured all Pi's to a NTP Server thus all have same System time. So basically I want the timestamp of System time not Boot Time. How can I do that ?
date +%s
returns Time in seconds since epoch(1-1-1970). How can I get time in microseconds Resolution. How much delay is in querying this value? By delay I mean suppose at time t
secs i query and it gives me value t + t'
what is t'
? My Use case: I am recording Videos using multiple Raspberry Pis simulatenously. Now I want to timestamp each frame of videos so that I can align them. Currently for timestamp it's using boot time(time since boot). Boot time is accurate but it's different for each Raspberry Pi. I have configured all Pi's to a NTP Server thus all have same System time. So basically I want the timestamp of System time not Boot Time. How can I do that ?
Coderaemon
(229 rep)
May 21, 2015, 10:23 AM
• Last activity: Jul 11, 2025, 10:46 AM
3
votes
3
answers
3231
views
Hardware and system clock gets offset by roughly 7 minutes on each boot although locale and time zone are correct
On each boot into Arch, I see that the time is off by a few minutes. The RTC time is off (as far as I understood, it has "drifted".) and affects the hardware clock. $ timedatectl status Local time: Mo 2018-02-12 12:45:18 CET Universal time: Mo 2018-02-12 11:45:18 UTC RTC time: Mo 2018-02-12 11:45:18...
On each boot into Arch, I see that the time is off by a few minutes. The RTC time is off (as far as I understood, it has "drifted".) and affects the hardware clock.
$ timedatectl status
Local time: Mo 2018-02-12 12:45:18 CET
Universal time: Mo 2018-02-12 11:45:18 UTC
RTC time: Mo 2018-02-12 11:45:18
Time zone: Europe/Berlin (CET, +0100)
System clock synchronized: no
systemd-timesyncd.service active: no
RTC in local TZ: no
**EDIT** Upon writing this post, I did not realize that the time values above this line are coherent to another. However they have an offset to my watch and smartphone time which is the aforementioned 7 minutes.
And my locale:
$ locale
LANG=de_DE.utf8
LC_CTYPE="de_DE.utf8"
LC_NUMERIC="de_DE.utf8"
LC_TIME="de_DE.utf8"
LC_COLLATE="de_DE.utf8"
LC_MONETARY="de_DE.utf8"
LC_MESSAGES="de_DE.utf8"
LC_PAPER="de_DE.utf8"
LC_NAME="de_DE.utf8"
LC_ADDRESS="de_DE.utf8"
LC_TELEPHONE="de_DE.utf8"
LC_MEASUREMENT="de_DE.utf8"
LC_IDENTIFICATION="de_DE.utf8"
LC_ALL=
So far I am very reluctant to use
hwclock --hctosys
as the man page states:
> This function should never be used on a running system. Jumping system time will cause problems, such as corrupted filesystem timestamps. Also, if something has changed the Hardware Clock, like NTP's '11 minute mode', then --hctosys will set the time incorrectly by including drift compensation.
As far as I can tell, [I configured Windows 10 correctly](https://superuser.com/questions/975717/does-windows-10-support-utc-as-bios-time) . Is there something I am missing or did I not set the clock up correctly?
**EDIT 2** Upon request, the contents of /etc/ntp.conf
:
# Please consider joining the pool:
#
# http://www.pool.ntp.org/join.html
#
# For additional information see:
# - https://wiki.archlinux.org/index.php/Network_Time_Protocol_daemon
# - http://support.ntp.org/bin/view/Support/GettingStarted
# - the ntp.conf man page
# Associate to Arch's NTP pool
server 0.arch.pool.ntp.org
server 1.arch.pool.ntp.org
server 2.arch.pool.ntp.org
server 3.arch.pool.ntp.org
# By default, the server allows:
# - all queries from the local host
# - only time queries from remote hosts, protected by rate limiting and kod
restrict default kod limited nomodify nopeer noquery notrap
restrict 127.0.0.1
restrict ::1
# Location of drift file
driftfile /var/lib/ntp/ntp.drift
henry
(964 rep)
Feb 12, 2018, 11:41 AM
• Last activity: Jul 3, 2025, 06:05 PM
5
votes
0
answers
39
views
Units of tick in struct timex
Linux header files and man pages for adjtimex(2) and ntp_adjtime(2) describe struct timex, containing a tick field that is described as the number of microseconds for each system clock tick. However, my Debian 10 and 12 systems have CONFIG_HZ=250, while ntp_adjtime(2) says that tick=10000, which wou...
Linux header files and man pages for adjtimex(2) and ntp_adjtime(2) describe struct timex, containing a tick field that is described as the number of microseconds for each system clock tick. However, my Debian 10 and 12 systems have CONFIG_HZ=250, while ntp_adjtime(2) says that tick=10000, which would correspond to a clock rate of 100Hz, not 250Hz.
This old-ish source says that in fact the adjtimex(2) and ntp_adjtime(2) tick value is an abstract value (mainly for use by NTP) that is the number of times an NTP abstract tick occurs in a day. This would resolve the conflict of an OS running with 250Hz clock ticks but having tick=10000. This tick=10000 would thus correspond to about 8.64 seconds.
It looks like the struct time tick value was originally the number of microseconds in a clock tick; early papers from David Mills say that this was the rate (100Hz) that the Solaris machines he was using ticked their system clock.
Are the units of struct timex's tick field now "number of ticks per day" or are they still number of microseconds per tick? If the latter, what ticks are being referenced, since clearly it does not correspond to the CONFIG_HZ value for my Linux kernels?
A Rooks
(51 rep)
Jun 17, 2025, 06:17 PM
0
votes
0
answers
52
views
PTP time sync in slave device not working?
I am trying to sync hardware clock with software clock in slave device in ptp setup, but the offset value suddenly jumps from 28 ns to -617 ns. I tried varying `pi_proportional_const(0.7)` and `pi_integral_const(0.3)` to stable the variations, but it didn't work. * sync command ```lang-sh phc2sys -s...
I am trying to sync hardware clock with software clock in slave device in ptp setup, but the offset value suddenly jumps from 28 ns to -617 ns. I tried varying
pi_proportional_const(0.7)
and pi_integral_const(0.3)
to stable the variations, but it didn't work.
* sync command
-sh
phc2sys -s eth0 -w CLOCK_REALTIME -O 0 -m
* log details of sync command
phc2sys[1289.198]: CLOCK_REALTIME phc offset 28 s2 freq +976 delay 6500
phc2sys[1290.198]: CLOCK_REALTIME phc offset -617 s2 freq +339 delay 3541
Amruta
(1 rep)
May 6, 2025, 04:02 AM
• Last activity: May 12, 2025, 02:36 PM
0
votes
2
answers
225
views
how and when does Linux read or change hardware (BIOS) clock
Scenario: - a Dell R740 server for example whose BIOS clock is first set, and it is set to UTC time but incorrectly and it is off 30 minutes. Then, a clean installation of Linux is performed (Redhat-8.10) and during installation the timezone is chosen, `New York` so EST. After installation, the time...
Scenario:
- a Dell R740 server for example whose BIOS clock is first set, and it is set to UTC time but incorrectly and it is off 30 minutes. Then, a clean installation of Linux is performed (Redhat-8.10) and during installation the timezone is chosen,
New York
so EST. After installation, the time as presented in Linux via date
is the correct local time but off 30 minutes, if we reference a peek at *time.gov* for correct time. There is no network connection to this server and no NTP/chrony is set up.
- My observation is, if I manually adjust time to be correct (referencing time.gov from a different computer or my phone) by doing date mmddhhmm
and then reboot, Linux reads the BIOS clock and then after booting the time in Linux is off 30 minutes again.
- On my home computer which has an asrock motherboard and 2 different SSD's one for win10 the other for RHEL-8.10 Linux, and an internet connection, my BIOS clock is set to local time and I use win10 most of the time (and windows had NTP active). On the times I boot Linux, the time in Linux is the correct local time as presented by date
however when I shutdown and then run windows the time in windows is then off by 4 or 5 hours; I am EST/EDT timezone.
Also:
> Windows expects the hardware clock to give “local time” by default. The reason is, according to Microsoft, so that users are not confused in BIOS menu; this is from a github page statement. Getting Windows to recognize BIOS (real-time-clock) as UTC apparently requires "tweaking"
---
- What is the deal with how Linux deals with the BIOS clock?
- **Am I expected** to use hwclock
?
- What's the proper convention regarding what the BIOS clock is set to, UTC or local?
- I seem to experience two different behaviors of Linux where it assumes on a Dell {enterprise style} server that the BIOS clock is UTC but on my cheap home asrock it is set to local time; And playing at home setting my asrock bios clock to UTC causes way more problems.
- **What are files in Linux** dealing with this, to understand what Linux is going to do regarding time? Does it always reference the BIOS clock upon boot, and where is it specified in Linux for what timezone it should assume the BIOS clock to be in?
ron
(8647 rep)
Apr 30, 2025, 01:59 PM
• Last activity: Apr 30, 2025, 09:06 PM
0
votes
0
answers
44
views
Changed behavior of sleep command in Linux suspend and resume testing
I am working on an embedded Linux system (kernel-5.10.220). Now I am testing the suspend and resume in this system with a watchdog time as the wakeup source to wake system up from suspend. The watchdog interrupt comes in every 5 seconds, and the script calls `sleep 10` to add 10 seconds delay betwee...
I am working on an embedded Linux system (kernel-5.10.220).
Now I am testing the suspend and resume in this system with a watchdog time as the wakeup source to wake system up from suspend.
The watchdog interrupt comes in every 5 seconds, and the script calls
sleep 10
to add 10 seconds delay between continous test.
And there is NO RTC in system!
Here is my testing script.
#!/bin/sh
trap ctrl_c INT
function ctrl_c()
{
echo "Exiting"
exit 0
}
count=0
sec=10
while [ true ]
do
echo ">>>>>>>>>>> Testing suspend $count"
echo mem > /sys/power/state
echo ">>>>>>>>>> Testing suspend 0
>>>>>>>>>> Testing suspend 1
>>>>>>>>>> Testing suspend 2
>>>>>>>>>> Testing suspend 3
>>>>>>>>>> Testing suspend 4
>>>>>>>>>> Testing suspend 5
>>>>>>>>>> Testing suspend 6
<<<<<<<<<<< Resumed after suspend
Thu Jan 1 06:33:12 UTC 1970
From the output of date
, the script did NOT delay 10 seconds between tests. The real interval of 10 seconds sleeping is about 2 or 3 seconds!
So why sleep 10
did NOT sleep for 10 seconds in the suspend and resume testing?
wangt13
(631 rep)
Apr 10, 2025, 01:14 AM
0
votes
1
answers
61
views
Clock Sidebar & Calendar
I recently took the leap to Pop OS, but I am struggling to find a Sidebar & Clock / calendar similar to my Windows set-up, see pic attached. Would really appreciate it if anyone has a similar set up. I'm a currency trader and use the clock frequently, especially the second hand. ``` Distributor ID:...
I recently took the leap to Pop OS, but I am struggling to find a Sidebar & Clock / calendar similar to my Windows set-up, see pic attached. Would really appreciate it if anyone has a similar set up. I'm a currency trader and use the clock frequently, especially the second hand.
Distributor ID: Pop
Description:Pop!_OS 22.04 LTS
Release: 22.04
Codename: jammy

user2193446
(1 rep)
Apr 1, 2025, 09:03 AM
• Last activity: Apr 1, 2025, 07:33 PM
2
votes
3
answers
1020
views
Negative time differences with `last reboot`
Looking at `last reboot | head -3`, I get the following result: ``` reboot system boot 5.7.10-201.fc32. Fri Jul 31 11:29 still running reboot system boot 5.7.10-201.fc32. Fri Jul 31 11:22 - 09:29 (-1:53) reboot system boot 5.7.10-201.fc32. Tue Jul 28 23:14 - 09:21 (2+10:07) ``` I thought at first th...
Looking at
last reboot | head -3
, I get the following result:
reboot system boot 5.7.10-201.fc32. Fri Jul 31 11:29 still running
reboot system boot 5.7.10-201.fc32. Fri Jul 31 11:22 - 09:29 (-1:53)
reboot system boot 5.7.10-201.fc32. Tue Jul 28 23:14 - 09:21 (2+10:07)
I thought at first that the times and dates were showed as "boot - shutdown", but this doesn't make sense considering the second line that shows a negative time difference.
procinfo
returns the correct boot time:
$ procinfo | grep Bootup
Bootup: Fri Jul 31 09:29:39 2020 Load average: 0.01 0.06 0.06 1/1071 28719
The hardware clock shows the correct time:
$ date; sudo hwclock --show
Fri 31 Jul 2020 11:55:17 AM CEST
2020-07-31 11:55:17.436472+02:00
The problem seems to lie with last reboot
and who -b
:
$ date; uptime; who -b
Fri 31 Jul 2020 11:55:43 AM CEST
11:55:43 up 2:26, 2 users, load average: 0.00, 0.04, 0.05
system boot 2020-07-31 11:29
/var/run/utmp
, read by default by who -b
, doesn't exist on my system and /var/log/wtmp
, read by last reboot
, has the following permissions:
$ ll /var/log/wtmp
-rw-rw-r--. 1 root utmp 39K Jul 31 11:23 /var/log/wtmp
What could be the reason of these discrepancies?
**EDIT**
The correct shutdown time is 09:29 UTC+2. The 11:29 and 11:22 times from last reboot
should be 09:29 and 09:22, respectively. As observed by @telcoM, one could think that early boot might be using UTC timezone, but then the 11:29 should be 07:29...
Another detail: I'm running a simple Fedora 32 physical machine.
Biblot
(178 rep)
Jul 31, 2020, 10:06 AM
• Last activity: Apr 1, 2025, 09:28 AM
9
votes
3
answers
10105
views
Change default sounds of gnome-clocks app
I'm use [gnome-clocks][1] for its timer option. This app is very simple and effective. But I can't change the default sounds of the alarm and the timer. I tried setting the configurations in **dconf** and `Settings > Sound > Sound Effects` but it's impossible to change. Where is the config file for...
I'm use gnome-clocks for its timer option. This app is very simple and effective. But I can't change the default sounds of the alarm and the timer. I tried setting the configurations in **dconf** and
Settings > Sound > Sound Effects
but it's impossible to change.
Where is the config file for this app? How can I change the default sounds?
user250189
Jan 24, 2018, 10:21 PM
• Last activity: Feb 21, 2025, 12:53 PM
0
votes
2
answers
181
views
How to confirm that the kernel is (or is not) updating the hwclock/RTC
This question is a follow-up to [this answer](https://unix.stackexchange.com/a/671093/286615). In general, my objective is to learn if my system (Debian/Raspberry Pi 5 'bookworm') is updating my RTC/hardware clock from the system time. Please note that the RPi 5 (unlike its Pi ancestors) does have a...
This question is a follow-up to [this answer](https://unix.stackexchange.com/a/671093/286615) . In general, my objective is to learn if my system (Debian/Raspberry Pi 5 'bookworm') is updating my RTC/hardware clock from the system time. Please note that the RPi 5 (unlike its Pi ancestors) does have an *in-built* RTC/hardware clock.
Here's what I've been able to determine so far:
##### 1. I feel I've established that the system clock is being updated from the hwclock:
$ dmesg | grep "system clock"
[ 1.588793] rpi-rtc soc:rpi_rtc: setting system clock to 2025-02-18T04:59:13 UTC (1739854753)
After some searching in dmesg
however, I can find no indication that the hwclock is being updated from system time. However, I **did** find a reference to a fake-hardware
clock (which seems *odd*). :
[ 4.037230] systemd: Starting fake-hwclock.service - Restore / save the current clock...
##### 2. The kernel is apparently configured to do clock updates in "both directions":
$ cat /boot/config-$(uname -r) | grep -i HCTOSYS
CONFIG_RTC_HCTOSYS=y
CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
$ cat /boot/config-$(uname -r) | grep -i SYSTOHC
CONFIG_RTC_SYSTOHC=y
CONFIG_RTC_SYSTOHC_DEVICE="rtc0"
It's occurred to me that the kernel ***may be*** performing the SYSTOHC sync only during shutdown, and maybe not being captured by dmesg
... but that's a WAG.
**Can someone explain how to confirm that the kernel is (or is not) updating the hwclock/RTC?**
Seamus
(3772 rep)
Feb 18, 2025, 05:53 AM
• Last activity: Feb 18, 2025, 09:27 AM
15
votes
5
answers
74210
views
RTC and System clock not in sync
How to set the system clock sync with RTC (Hardware Clock / BIOS). I am writing a script that uses a system clock in order to start the system with alarm. For this the sole requirement is to have a proper RTC clock. On my test system (SLES 10 SP4), I use NTP Server to manage the system clock. But th...
How to set the system clock sync with RTC (Hardware Clock / BIOS). I am writing a script that uses a system clock in order to start the system with alarm.
For this the sole requirement is to have a proper RTC clock. On my test system (SLES 10 SP4), I use NTP Server to manage the system clock. But the RTC clock is always ahead.
So for example : currently the system clock shows
14:00 26.05.2016
and the RTC shows 16:00
Hrs. I read the man pages of hwclock
and it shows that following command
hwclock --systohc --localtime
would sync the RTC clock to system clock. Which it did.
But after a reboot/shutdown, when the system comes up again, the RTC is again messed up. So there is something more which controls the RTC when the system is rebooted.
Could someone point me in the right direction. Thanks in advance.
Sachin H
(171 rep)
May 26, 2016, 01:01 PM
• Last activity: Feb 15, 2025, 07:59 PM
133
votes
7
answers
708522
views
Linux: set date through command line
How to change the system date in Linux ? I want to change: * Only Year * Only Month * Only Date * Any combination of above three
How to change the system date in Linux ?
I want to change:
* Only Year
* Only Month
* Only Date
* Any combination of above three
SHW
(15376 rep)
Aug 22, 2014, 09:40 AM
• Last activity: Feb 12, 2025, 01:09 PM
4
votes
1
answers
2679
views
Who sets date/time automatically from the hardware clock at boot?
When Linux is booting, the current time must be fetched from a RTC chip and then set to Linux system date/time. I can do this manually by running `hwclock --hctosys`. But where exactly does this happen automatically at boot time? Is there a process taking care of this? Does the kernel do this job?
When Linux is booting, the current time must be fetched from a RTC chip and then set to Linux system date/time. I can do this manually by running
hwclock --hctosys
. But where exactly does this happen automatically at boot time? Is there a process taking care of this? Does the kernel do this job?
arminb
(251 rep)
Oct 13, 2021, 02:47 PM
• Last activity: Feb 11, 2025, 02:09 AM
3
votes
1
answers
2088
views
Keep system clock synchronized to hardware clock
The situation: - We have some Linux VMs running compute jobs. - The VMs do not have Internet access (including NTP). - The hypervisor does know the correct time. - The hypervisor's time is exposed to the VM via its hardware clock. - The hypervisor seems to be QEMU/KVM-based. We do not control the hy...
The situation:
- We have some Linux VMs running compute jobs.
- The VMs do not have Internet access (including NTP).
- The hypervisor does know the correct time.
- The hypervisor's time is exposed to the VM via its hardware clock.
- The hypervisor seems to be QEMU/KVM-based. We do not control the hypervisor (it is a cloud VPS offering).
The problem:
- The VMs' system clock drifts away from the correct time / hardware clock.
The question:
- Is it possible to keep the system clock synchronized to the hardware clock at all times?
- Alternatively, is it possible to tell e.g. ntpd to account for system clock drift, using the hardware clock as reference?
What I tried:
- A
0 * * * * hwclock --hctosys
cronjob, however, the drift is significant enough that even hourly synchronization is insufficient, and increasing the cronjob frequency seems like a workaround at this point.
Vladimir Panteleev
(1871 rep)
Apr 7, 2022, 04:34 PM
• Last activity: Feb 4, 2025, 01:07 PM
0
votes
0
answers
26
views
Generic clock consumer in the common clock framework
In my setup, there is a clock generator that use the common clock framework in the Linux kernel. The clock generator has an output clock that I would like to feed to an external connector. If I have understood the common clock framework correctly, the generic setup is the following: ``` source_clock...
In my setup, there is a clock generator that use the common clock framework in the Linux kernel. The clock generator has an output clock that I would like to feed to an external connector. If I have understood the common clock framework correctly, the generic setup is the following:
source_clock --> clock modifier (mux, gate, pll, ...) --> clock consumer
I'm not quite sure I understand the clock consumer part. By default, the clocks are disabled and are only enabled when a consumer (which I assume to always be a driver) enables them. Does this always have to be a specific driver? What if, like in my case, the clock should only be forwarded to some external connector? Similarly, what if the clock is fed to some FPGA pin where a dedicated driver doesn't really make sense? Am I missing some generic clock consumer that "just requests some output frequency and enables the clock", similar to the fixed-clock
producer?
Lukas
(1 rep)
Nov 12, 2024, 10:22 AM
1
votes
0
answers
91
views
How to perform purely software based time synchronization using PTP?
My two machines do not support hardware timestamping: ``` ethtool -T eno1 Time stamping parameters for eno1: Capabilities: software-transmit software-receive software-system-clock PTP Hardware Clock: none Hardware Transmit Timestamp Modes: none Hardware Receive Filter Modes: none ``` How can I achie...
My two machines do not support hardware timestamping:
ethtool -T eno1
Time stamping parameters for eno1:
Capabilities:
software-transmit
software-receive
software-system-clock
PTP Hardware Clock: none
Hardware Transmit Timestamp Modes: none
Hardware Receive Filter Modes: none
How can I achieve software-based time synchronization between these two machines using linuxptp
?
I tried following https://tsn.readthedocs.io/timesync.html - this tutorial, but this assumes hardware timestamping.
I tried using ptp4l -S
option but phc2sys
fails because it cannot find a valid source.
soham
(111 rep)
Oct 22, 2024, 03:22 AM
2
votes
1
answers
3326
views
PTP time syncing not working, why its always selecting best master clock as local clock?
I am trying to sync the time with PTP; I've configured the Trimble device with PTP. However, when I use LinuxPTP with the below configuration, the local clock is always selected as the best master clock. ```none ptp4l[892.103]: selected local clock 00032d.fffe.55bd3b as best master ``` I wonder why...
I am trying to sync the time with PTP; I've configured the Trimble device with PTP. However, when I use LinuxPTP with the below configuration, the local clock is always selected as the best master clock.
ptp4l[892.103]: selected local clock 00032d.fffe.55bd3b as best master
I wonder why it's not picking up the Trimble device as the master clock.
Devices are connected via SFP/Fiber optic cables.
* PTP Config file - /etc/linuxptp/ptpv2.conf
[global]
verbose 1
domainNumber 24
clockClass 6
priority1 128
priority2 128
[enp11s0]
* Run with sudo
like this and console this output.
-shellsession
$ sudo ptp4l -f /etc/linuxptp/ptpv2.conf
ptp4l[886.038]: selected /dev/ptp7 as PTP clock
ptp4l[886.039]: port 1 (enp11s0): INITIALIZING to LISTENING on INIT_COMPLETE
ptp4l[886.039]: port 0 (/var/run/ptp4l): INITIALIZING to LISTENING on INIT_COMPLETE
ptp4l[886.039]: port 0 (/var/run/ptp4lro): INITIALIZING to LISTENING on INIT_COMPLETE
ptp4l[892.103]: port 1 (enp11s0): LISTENING to MASTER on ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES
ptp4l[892.103]: selected local clock 00032d.fffe.55bd3b as best master
ptp4l[892.103]: port 1 (enp11s0): assuming the grand master role
* I also captured the Wireshark Announce Message to see if it's helpful to debug this.
Frame 9466: 78 bytes on wire (624 bits), 78 bytes captured (624 bits) on interface enp11s0, id 0
Ethernet II, Src: Trimble_70:07:6a (00:17:47:70:07:6a), Dst: IEEEI&MS_00:00:00 (01:1b:19:00:00:00)
Precision Time Protocol (IEEE1588)
0000 .... = majorSdoId: Unknown (0x0)
.... 1011 = messageType: Announce Message (0xb)
0000 .... = minorVersionPTP: 0
.... 0010 = versionPTP: 2
messageLength: 64
domainNumber: 24
minorSdoId: 0
flags: 0x003c
0... .... .... .... = PTP_SECURITY: False
.0.. .... .... .... = PTP profile Specific 2: False
..0. .... .... .... = PTP profile Specific 1: False
.... .0.. .... .... = PTP_UNICAST: False
.... ..0. .... .... = PTP_TWO_STEP: False
.... ...0 .... .... = PTP_ALTERNATE_MASTER: False
.... .... .0.. .... = SYNCHRONIZATION_UNCERTAIN: False
.... .... ..1. .... = FREQUENCY_TRACEABLE: True
.... .... ...1 .... = TIME_TRACEABLE: True
.... .... .... 1... = PTP_TIMESCALE: True
.... .... .... .1.. = PTP_UTC_REASONABLE: True
.... .... .... ..0. = PTP_LI_59: False
.... .... .... ...0 = PTP_LI_61: False
correctionField: 0.000000 nanoseconds
correction: Ns: 0 nanoseconds
correctionSubNs: 0 nanoseconds
messageTypeSpecific: 0
ClockIdentity: 0x001747fffe70076a
MAC Vendor: Trimble
SourcePortID: 1
sequenceId: 28828
controlField: Other Message (5)
logMessagePeriod: -3
originTimestamp (seconds): 0
originTimestamp (nanoseconds): 0
originCurrentUTCOffset: 37
priority1: 128
grandmasterClockClass: 6
grandmasterClockAccuracy: The time is accurate to within 100 ns (0x21)
grandmasterClockVariance: 20061
priority2: 128
grandmasterClockIdentity: 0x001747fffe70076a
localStepsRemoved: 0
TimeSource: GPS (0x20)
* Sync Command
-shell
phc2sys -w -m -s enp11s0 -c CLOCK_REALTIME
When I check some other configs on the internet, their logs show the correct clock selection, but mine always selects the best master clock as the local clock, and it won't sync the time from the master/boundary clock (right now, I am using a Trimble 1570001820 device with GPS).
Other notes:
* NTP disabled
* Hardware is capable of handling PTP, and the latest drivers are installed.
Elshan
(123 rep)
Apr 4, 2024, 11:15 PM
• Last activity: Oct 4, 2024, 10:48 AM
0
votes
0
answers
145
views
QEMU ubuntu guest os RTC time (-rtc base=2023-0401)
I created an VM using the following command : ``` qemu-img create -f raw myVirtualDisk.raw 20G qemu-system-x86_64 -enable-kvm -m 8G -smp 8 -boot d -cdrom /home/danny/2T/tmp/iso-image/ubuntu-24.04.1-live-server-amd64.iso -drive file=/home/danny/myVirtualDisk.raw,format=raw -netdev user,id=net0,net=19...
I created an VM using the following command :
qemu-img create -f raw myVirtualDisk.raw 20G
qemu-system-x86_64 -enable-kvm -m 8G -smp 8 -boot d -cdrom /home/danny/2T/tmp/iso-image/ubuntu-24.04.1-live-server-amd64.iso -drive file=/home/danny/myVirtualDisk.raw,format=raw -netdev user,id=net0,net=192.168.0.0/24,dhcpstart=192.168.0.9 -device virtio-net-pci,netdev=net0 -vga qxl -device AC97 -rtc base=2023-04-01
after successfully install the OS, I start the VM with command:
qemu-system-x86_64 -enable-kvm -m 8G -smp 8 -drive file=/home/danny/myVirtualDisk.raw,format=raw -netdev user,id=net0,net=192.168.0.0/24,dhcpstart=192.168.0.9 -device virtio-net-pci,netdev=net0 -vga qxl -device AC97 -rtc base=2023-04-01
but when the VM is up and logged in, when I issue date
command the result is still today , the -rtc base=2023-04-01
does not seem to work.
danny
(103 rep)
Sep 29, 2024, 02:56 PM
• Last activity: Sep 29, 2024, 05:47 PM
83
votes
10
answers
237902
views
How do I set time and date from the Internet?
How do I retrieve the date from the Internet and set my computer's clock, from the command line?
How do I retrieve the date from the Internet and set my computer's clock, from the command line?
Mohsen
(2705 rep)
Jun 12, 2013, 05:40 AM
• Last activity: Aug 11, 2024, 03:11 AM
4
votes
1
answers
573
views
Show live clock in bash in front of command prompt
I am looking for a way to show the current live time/clock in bash before the command prompt. What I researched so far, there are some possibilities for that. E.g. I know the bash variable `PS1` can be customized with `\t` but that only updates the clock every time you press enter. For example one c...
I am looking for a way to show the current live time/clock in bash before the command prompt. What I researched so far, there are some possibilities for that. E.g. I know the bash variable
PS1
can be customized with \t
but that only updates the clock every time you press enter.
For example one can put this in ~/.bashrc
what I currently have:
PS1='[\t] \[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w \$ \[\033[00m\]'
But that is not what I want - my goal is something like shown here which uses something like following code what I also have in my ~/.bashrc
:
while sleep 1;do tput sc;tput cup $(($(tput lines)-1)) 0;printf [date +%H:%M:%S
];tput rc;done &
This is nearly perfect for me, the only problem with this code is, it works well until I send SIGINT
e.g. by pressing control+c. I would like a solution like that which does not stop the clock (or that particular subshell where the clock runs) when pressing control+c. I want to be able to use control+c like usual in bash.
To be clear, I also found a solution for this with zsh but I would like to do that with bash if anyhow possible. And I do not want the clock to be shown elsewhere in the terminal , it should be shown live at the prompt, so I can e.g. even scroll back up the terminal and look at what time/second exactly I issued a command.
Thanks in advance!
Christoph
(273 rep)
Jul 28, 2024, 10:29 PM
• Last activity: Jul 30, 2024, 06:46 AM
Showing page 1 of 20 total questions