Convert tm struct to time_t ? 
Author Message
 Convert tm struct to time_t ?

        Does anyone know of a function (or code fragment) that will take
as an input a "struct tm *" and return a time_t (seconds) value?

        I need this functionin order to calculate the difference (in
seconds) between two dates.

Thanks in advance,

Mark O'Toole

--
Mark C. O'Toole
Air Products and Chemicals

The Opinions listed here are solely my own



Sat, 10 Jan 1998 03:00:00 GMT  
 Convert tm struct to time_t ?

Quote:
>    Does anyone know of a function (or code fragment) that will take
>as an input a "struct tm *" and return a time_t (seconds) value?

>    I need this functionin order to calculate the difference (in
>seconds) between two dates.

>Thanks in advance,

>Mark O'Toole

 Yep, it's called mktime();

George Varndell



Sat, 10 Jan 1998 03:00:00 GMT  
 Convert tm struct to time_t ?
mktime.


Sat, 10 Jan 1998 03:00:00 GMT  
 Convert tm struct to time_t ?

Quote:
>    Does anyone know of a function (or code fragment) that will take
> as an input a "struct tm *" and return a time_t (seconds) value?

Look up mktime().

-------------------------------------------------------------
MicroFirm: Down to the C in chips...
FidoNet 1:106/2000.6

Home of SNIPPETS - Current release:
        oak.oakland.edu:/SimTel/msdos/c/snip9503.zip
        juge.com:/c/file/c/snip9503.lzh



Sat, 10 Jan 1998 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Converting a struct tm in UTC to a time_t

2. Converting a struct tm in UTC to a time_t

3. Fast conversion between time_t and struct tm?

4. struct tm -> time_t converter wanted

5. From (struct tm) to (time_t) ?

6. about function struct tm *localtime( const time_t *timer );

7. Need help converting from tm struct to DATE

8. time_t, tm*, and timezones (please read!)

9. time_t, tm*, and timezones (please read!)

10. convert struct tm --> time_t or DATE?

11. Compare tm and time_t

12. struct tm and miliseconds

 

 
Powered by phpBB® Forum Software