How do we compare various timestamp in a C program on Unix?
I have to write a pgm which will check a ctime
of a file and if it is <
the machine boot time, the file will be removed. I am using getutxid
to get the BOOT_TIME
and stat()
for the file ctime
. It seems the timestamps returned against these two are in different format. What is the common format and how to convert so that logical comparisons are possible? Such as:
if (ctime < boottime)
and etc.
Copyright Notice:Content Author:「user2187316」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/15504677/unix-timestamp-comparisons