C/I am trying to find a simple program to convert a time to epoch time.
Expert: Narendra - 7/5/2004
Question-------------------------
Followup To
Question -
I am trying to find a program that converts a date and time to Unix epoch time (I am using a solaris system). For instance,
Thu, 20 May 2004 00:27:15 needs to be converted to epochtime. I know it is not a real hard program but I cannot program in C.
I would really appreciate it if you could help me.
Rachel Alexander
Answer -
I think the function mktime() is what you are looking for.
It is there in Linux. Check if it is in Solaris also?
-ssnkumar
mktime is indeed a function in solaris. But seeing as I can't program in C I don't know what kind of structure to give my program.
Rachel
AnswerRead the man page.
Here is the structure used by it:
struct tm {
int tm_sec; /* seconds */
int tm_min; /* minutes */
int tm_hour; /* hours */
int tm_mday; /* day of the month */
int tm_mon; /* month */
int tm_year; /* year */
int tm_wday; /* day of the week */
int tm_yday; /* day in the year */
int tm_isdst; /* daylight saving time */
};
-ssnkumar