The following epoch timestamps were converted to human time via Here is my attempt at converting the 3rd party device localtime based seconds since epoch to UTC based seconds since epoch. How would I take the seconds since epoch provided by the device (in localtime) and convert it to seconds since epoch in UTC? In other words, what the programmatic (in C) way to apply PC timezone settings to a seconds since epoch when that number is in localtime? Let's assume that the timezone settings (UTC offset and daylight savings specifications) are the same between the PC and this device. This is a problem because, when I print the two timestamps in an interleaved log with timestamps from PC and this device, even though the two clocks show the same localtime, the timestamps are off. I also have a 3rd party network device which provides its time also as seconds from epoch, but it does so using localtime instead of UTC time. In PC code, I get UTC time as seconds since epoch using struct timespec tv ĭouble time = (tv.tv_nsec / 1000000000.0) + tv.tv_sec In my system I have a PC (Linux, in case it matters) which keeps RTC time in UTC, making my localtime timezone specific.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |