Wall time with milliseconds in Linux C

Having found many quite old questions about this subject, I wonder if getting the current time in Linux C with year, month, day, hours, minutes, seconds and milliseconds still is so cumbersome these days.

I searched a lot but there are either structs holding the wall time without milliseconds, or structs returning the current time in milliseconds that I have to convert into wall time separately, or functions that return seconds and milliseconds in extra fields which would be ok to use but isn't what I'd call elegant.

Does a time struct like this

struct TIME_WITH_ALL_FIELDS now;
get_now(&now);
print ("today is ...",
  now.year, now.month, now.day,
  now.hour, now.minute, now.second, now.millisecond);

really not exist yet?



Comments

Popular posts from this blog

Today Walkin 14th-Sept

Hibernate Search - Elasticsearch with JSON manipulation

Spring Elasticsearch Operations