Pos mporo na paro tin localtime se c programa?

Dimitris Kamenopoulos el97146 at mail.ntua.gr
Fri May 25 02:48:00 EEST 2001


Spyros Giannopulos wrote:

> Thelo se ena C programma pou ftiaxno na paro tin time tou mixanimatos alla
> den mporo na to petixo oute me tin time() oute me tin gettimeofday().
> Kserei kaneis pos sintasontai autes oi entoles;
> Episis an kserei kaneis pos mporo na paro tin ora se sec apo to 1970 i se
> string tis morfis pou dinei kai i synartisi ctime tha tou eimai ypoxreos.
apo to 
$ man 2 gettimeofday:

       #include <sys/time.h>
       #include <unistd.h>
 
       int gettimeofday(struct timeval *tv, struct timezone *tz);
       int settimeofday(const struct timeval *tv ,  const  struct
       timezone *tz);
 
DESCRIPTION
       gettimeofday  and settimeofday can set the time as well as
       a timezone.  tv is a  timeval  struct,  as  specified   in
       /usr/include/sys/time.h:
 
       struct timeval {
               long tv_sec;        /* seconds */
               long tv_usec;  /* microseconds */
       };
 
 
       and tz is a timezone :
       The use of the timezone struct is obsolete; the tz_dsttime
       field has never been used under Linux - it  has  not  been
       and  will  not  be  supported  by libc or glibc.
...
gia to deftero: 
#include <time.h>
time(time_t * t)
(simeiwnw pws to t einai deiktis).
Dimitris



More information about the Linux-greek-users mailing list