Skip to contentSkip to conversation

Get wallclock time from rtdm driver

DISCUSSION François Legal 3 participants 5 messages Sep 26, 2024

lore
Share & tools
lore
#0 lore raw

Hello,

in my driver, I need to get the current wallclock value. I tried rtdm_clock_read, but this seems to be the boot clock and not the wallclock (the one that is updated by ntp/...)

What shall I use to get the actual wallclock value from my rt drivers (the equivalent from clock_gettime (CLOCK_HOST_REALTIME)) ?

Thanks in advance

François

#1 lore raw
Quoted 6 lines · François Legal

Hello,

in my driver, I need to get the current wallclock value. I tried rtdm_clock_read, but this seems to be the boot clock and not the wallclock (the one that is updated by ntp/...)

What shall I use to get the actual wallclock value from my rt drivers (the equivalent from clock_gettime (CLOCK_HOST_REALTIME)) ?

rtdm_clock_read should give you CLOCK_REALIME, rtdm_clock_read_monotonic CLOCK_MONOTONIC. Which version are we talking about here? And which kernel?

Jan

Signature · 2 lines
Siemens AG, Technology
Linux Expert Center
#2 lore raw
Quoted 11 lines · Jan Kiszka
Quoted 6 lines · François Legal

Hello,

in my driver, I need to get the current wallclock value. I tried rtdm_clock_read, but this seems to be the boot clock and not the wallclock (the one that is updated by ntp/...)

What shall I use to get the actual wallclock value from my rt drivers (the equivalent from clock_gettime (CLOCK_HOST_REALTIME)) ?

rtdm_clock_read should give you CLOCK_REALIME, rtdm_clock_read_monotonic CLOCK_MONOTONIC. Which version are we talking about here? And which kernel?

I'm talking about rtdm_clock_read. What I get from that is about the number of elasped seconds since system startup. Not the time corrected from RTC or NTP.

I'm on linux 5.4 Ipipe.

François

Quoted 6 lines

Jan

--
Siemens AG, Technology
Linux Expert Center

#3 lore raw
Quoted 10 lines · François Legal
Quoted 8 lines · Jan Kiszka
Quoted 6 lines · François Legal

Hello,

in my driver, I need to get the current wallclock value. I tried rtdm_clock_read, but this seems to be the boot clock and not the wallclock (the one that is updated by ntp/...)

What shall I use to get the actual wallclock value from my rt drivers (the equivalent from clock_gettime (CLOCK_HOST_REALTIME)) ?

Quoted 7 lines
Quoted 3 lines

rtdm_clock_read should give you CLOCK_REALIME, rtdm_clock_read_monotonic CLOCK_MONOTONIC. Which version are we talking about here? And which kernel?

I'm talking about rtdm_clock_read. What I get from that is about the number of elasped seconds since system startup. Not the time corrected from RTC or NTP.

I'm on linux 5.4 Ipipe.

Then you need to compare to Xenomai's real-time clock, not that of the system. They were decoupled with I-pipe.

Jan

Signature · 2 lines
Siemens AG, Technology
Linux Expert Center
#4 lore raw
Quoted 15 lines · Jan Kiszka
Quoted 14 lines · François Legal
Quoted 11 lines · Jan Kiszka
Quoted 6 lines · François Legal

Hello,

in my driver, I need to get the current wallclock value. I tried rtdm_clock_read, but this seems to be the boot clock and not the wallclock (the one that is updated by ntp/...)

What shall I use to get the actual wallclock value from my rt drivers (the equivalent from clock_gettime (CLOCK_HOST_REALTIME)) ?

rtdm_clock_read should give you CLOCK_REALIME, rtdm_clock_read_monotonic CLOCK_MONOTONIC. Which version are we talking about here? And which kernel?

Quoted 6 lines
Quoted 3 lines

I'm talking about rtdm_clock_read. What I get from that is about the number of elasped seconds since system startup. Not the time corrected from RTC or NTP.

I'm on linux 5.4 Ipipe.

Then you need to compare to Xenomai's real-time clock, not that of the system. They were decoupled with I-pipe.

I'm not sure I understand. How shall I compare what with what ?

François

Quoted 7 lines

Jan

--
Siemens AG, Technology
Linux Expert Center