From: Salvador Ramirez <sram () profc ! udec ! CL>
To: tru64-unix-managers
Subject: localtime(3) function output not Y2K?
Date: Sat, 13 Mar 1999 01:04:36 +0000 [thread overview]
Message-ID: <96079038515661.tru64-unix-managers.marc@archive.invalid> (raw)
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
reply other threads:[~1999-03-13 1:04 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox