Expanding timeval OR timespec struct.

I’m looking for existing POSIX/QNX functions to expand either timeval or timespec to get U32 values from s/ms or s/ns to: year, day, etc. down to microseconds.

This is to port win32 SYSTEMTIME structure (GetSystemTime()) attributes.

I can see gettimeofday() returns a timeval that has a milliseconds resolution. Or I could use clock_gettime() for ns resolution (timepsec).

My problem is:
How do you convert a timeval (or timespec) structure to get:
Year, Month, DayOfWeek, Day, Hour, Minute, Seconds and milliseconds?

If there are no POSIX or QNX calls, I’ll make my own converison function, but it seemed like this would have been addressed already.

Thanks for any responses.

It’s probably quicker to write your own wrapper function.

Look up the the ANSI C time() function and it’s relatives.