There are Unix time to yy:mm:dd hh:mm:ss source code available on the internet.
I've created my own version of it that minimizes month calculation iterations. (It assumes no Unix Time values are earlier than Jan 1, 2020.)
If you're looking to convert UTP via NTP servers, I believe there is at least one example project for the PSoC6.
If the routine is part of a built-in library I can probably get by without having to include it in the formal verification for my project. If I pull in source code of unknown providence (FDA terminology) I do. So I was hoping for a built in solution.
I also have looked out in the internet for a straight forward c language conversion routine. The internet is now so cluttered it is harder to find such an routine than you might think. Since I won't permit dates earlier than Jan 1, 2020, I could use your version. Can you post a link to it? Or just paste it in a reply?
I looked back at my code archives. I think I abandoned my UTC processing. I ended up using the following code.
I converted this code from C++ code to C. Hopefully it works. Either way it's a start.
It's time starting reference is Jan 1, 1970.
PS: Just test the parseTime() function. It works.
Note the following:
- The Year field is the years since 1970.
- There is no Daylight Savings Time correction.
- There is no time zone correction.
time.zip 3.1 K