[H-GEN] time.h

Martin Pool mbp at meesha.humbug.org.au
Mon May 18 22:58:14 EDT 1998


>I know that this is probably not quite on topic but i am in a bit of a
>pickle. 

Yeah, it's on topic but RTFM.

>/* i want to be able to read in GMT time into the struct...is this right?
>*/
>
>mktime(timebits);
>
>/*i want to be able to do something like this....*/
>printf("%d:%d:%d", timebits.tm_hour , timebits.tm_min, timebits.tm_sec);

Try this:

  char buf[SMALL_AND_DANGEROUS];
  struct tm *broken;
  broken = gmtime(time(NULL));
  strftime(buf, sizeof(buf)-1, "%T", broken);
  fputs(buf, stdout);

Obvious, no?  Or get a real programming language. <laughs,dr>

--
Martin



----------------------- HUMBUG General List --------------------------------
echo "unsubscribe general" | mail majordomo at humbug.org.au # To Unsubscribe



More information about the General mailing list