1. What is the reference of the timestamp in struct "TPCANRdMsg", for example epoch?
2. Is there any C++11 standard library that can provide the same reference of the timestamp in struct "TPCANRdMsg"?
thx
The definition of timestamp in struct TPCANRdMsg
Re: The definition of timestamp in struct TPCANRdMsg
Hi,
the driver time is based on the Linux Jiffies, see pcan_main.c line 2104 for more details:
regards
Michael
the driver time is based on the Linux Jiffies, see pcan_main.c line 2104 for more details:
Code: Select all
/* request time in msec, fast */
u32 get_mtime(void)
{
/* return (jiffies / HZ) * 1000; */
return jiffies_to_msecs(jiffies);
}
Michael
Re: The definition of timestamp in struct TPCANRdMsg
Thx for your answer. There is another question: how can I use "get_mtime(void)" or "jiffies_to_msecs(jiffies)" in my code (in user space)?M.Maidhof wrote:Hi,
the driver time is based on the Linux Jiffies, see pcan_main.c line 2104 for more details:
regardsCode: Select all
/* request time in msec, fast */ u32 get_mtime(void) { /* return (jiffies / HZ) * 1000; */ return jiffies_to_msecs(jiffies); }
Michael
regards
yangming0
- S.Grosjean
- Software Development
- Posts: 357
- Joined: Wed 4. Jul 2012, 17:02
Re: The definition of timestamp in struct TPCANRdMsg
Hi,
These calls are Kernel specific. If you want to get time in the same way than the pcan driver, your application should use "struct timeval" objects and "gettimeofday()" from standard libc.
Regards,
Stéphane
These calls are Kernel specific. If you want to get time in the same way than the pcan driver, your application should use "struct timeval" objects and "gettimeofday()" from standard libc.
Regards,
Stéphane
— Stéphane
Re: The definition of timestamp in struct TPCANRdMsg
As nobody closed this topic, let me ask for advice regard Timestamp - what is best way to convert timestamp to epoch, or any other universla time? Best in Python or Python-supported
- S.Grosjean
- Software Development
- Posts: 357
- Joined: Wed 4. Jul 2012, 17:02
Re: The definition of timestamp in struct TPCANRdMsg
Hi,
TPCANRdMsg struct type defines "dwTime" as a number of milliseconds. This counter is a 32-bit value so it's obvious that it can't contain any epoch time. It should be used to compute delays between received messages only. These types are kept for compatibility only. If you'd like to deal with more modern timestamps, you'll have to switch to the other and newer API of the driver. Please read the documentation provided by the package.
Regards,
TPCANRdMsg struct type defines "dwTime" as a number of milliseconds. This counter is a 32-bit value so it's obvious that it can't contain any epoch time. It should be used to compute delays between received messages only. These types are kept for compatibility only. If you'd like to deal with more modern timestamps, you'll have to switch to the other and newer API of the driver. Please read the documentation provided by the package.
Regards,
— Stéphane