Time format conversion problem

Peter Lim pnl at hpfinote.HP.COM
Sun May 6 11:08:44 AEST 1990


I'm having a bit of problem with time in C. Consider the following 
program fragment.


#include <time.h>

struct	tm	the_time;
long	time_in_long;

/* To convert time_in_long to the_time, I use .... */
the_time = localtime (&time_in_long);

/* To convert the_time to time_in_long, what do I do ?? */
time_in_long = XXXXXX (&the_time);


I found that in Microsoft or Zortech C, XXXXXX() is mktime(); but
I need to move the program to a UNIX environment which doesn't have
mktime(). So, I'm stuck.

Anybody know which library function works the same as mktime(), 
or have some C code to replace the function ??

My UNIX manual says that time_in_long should store the value of the
time in seconds from 00:00:00 January 1, 1970. If this help ?


Regards,                       ## Life is fast enough as it is ........
Peter Lim.                     ## .... DON'T PUSH IT !!          >>>-------,
                               ########################################### :
E-mail:  plim at hpsgwg.HP.COM     Snail-mail:  Hewlett Packard Singapore,    :
Tel:     (065)-279-2289                      (ICDS, ICS)                   |
Telnet:        520-2289                      1150 Depot Road,           __\@/__
  ... also at: pnl at hpfipnl.HP.COM            Singapore   0410.           SPLAT !



More information about the Comp.lang.c mailing list