tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* localtime(3) function output not Y2K?
@ 1999-03-13  1:04 Salvador Ramirez
  0 siblings, 0 replies; only message in thread
From: Salvador Ramirez @ 1999-03-13  1:04 UTC (permalink / raw)
  To: tru64-unix-managers

I have done a little C program to get the local time and I used 
localtime(3) to do that but I get a not expected output. In 
/usr/include/time.h is defined the struct "tm" which one of its
fields is an integer called tm_year for storing the year but
this field show only (at this time) 99!. 
Another question is if you have man page for the "time" C function?
on my system I only get the man pages for time(1) command. 
My program looks like the following:

...
struct tm *test;
time_t tim;

 tim = time(0);
 test = (struct tm *)localtime( &tim );
 
printf("%d\n", test->tm_year);
...

I know that asctime(3) return a string that have the complete
specification of the year (1999) but I would like to use localtime
because it return the day, hour, ..., year in different fields that 
you can manipulate. Is this a localtime bug or now there is a 
function that get the current century?.. I don't think so but it
maybe would be useful

Thank you in advance!

---sram
               If God does not exist, it would be necessary
                         to invent him --Voltaire
Salvador Ramirez Flandes        PROFC, Universidad de Concepcion, CHILE 
http://www.profc.udec.cl/~sram                mailto:sram@profc.udec.cl

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1999-03-13  1:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-03-13  1:04 localtime(3) function output not Y2K? Salvador Ramirez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox