[LCP]time

JoachimBauernbergerbj at gmx.net JoachimBauernbergerbj at gmx.net
Tue Feb 5 17:11:45 UTC 2002


Hi,
thanks for all the advice.
I posted the message below immediately after my first post but I think it 
didn't go through...
So here it is again. Thanks to those who pointed out that stupid mistake.

------------------------------------------------

I should have been more carefully looking at what I am doing!
Stupid me forgot the darn time(&now);
Sorry for that dumb post!!

Regards,
Joachim

On Friday 18 January 2002 20:38, you wrote:
> Hi,
> I am having a little problem with time. For some reason the code below will 
> have the following output:
> 
> [bjdev: C]$ ./time
> 12 41 10 23 11 35 1
> Mon Dec 23 10:41:12 1935
> 
> The actual time however is:
> [bjdev: C]$ date
> Fre Jan 18 20:35:29 CET 2002
> 
> 
> Can somebody be so kind and tell me what I am doing wrong (maybe it's time 
> for me to get some sleep .... :))
> 
> 
> Here is the code:
> 
> #include <time.h>
> #include <stdio.h>
> 
> int main( int argc, char **argv) {
> 
>     time_t          now;
>     struct tm       *tt;
>     char *c;
> 
>     tt = localtime(&now);
>     //c = ctime(&now);
> 
>     fprintf(stdout,"%d %d %d %d %d %d %d\n",tt->tm_sec, tt->tm_min, 
> tt->tm_hour, tt->tm_mday, tt->tm_mon, tt->tm_year, tt->tm_wday);
>     //fprintf(stdout,"\n%s\n",c);
>     c = asctime(tt);
>     fprintf(stdout,"%s\n",c);
> 
> return 0;
> }
> 
> -- 
> You can get my public pgp key here:
> http://www.mxscan.com/pgp/joachim.asc
> PGP fingerprint:
> 25 96 E0 25 48 D9 8E 10  3C C0 48 E7 AF 5A E2 C6  A3 15 05 E6
> 
> _______________________________________________
> This is the Linux C Programming List
> :  http://lists.linux.org.au/listinfo/linuxcprogramming List
> 
> 

-- 
You can get my public pgp key here:
http://www.mxscan.com/pgp/joachim.asc
PGP fingerprint:
25 96 E0 25 48 D9 8E 10  3C C0 48 E7 AF 5A E2 C6  A3 15 05 E6







More information about the linuxCprogramming mailing list