How to get the time...

Sorcerer rmacgreg at cs.strath.ac.uk
Mon Feb 18 20:31:39 AEST 1991


I'm trying to get the time and date using the ctime() function, but I've come
up against a rather large problem...  Ctime() expects a long int as an
argument, but the manual doesn't say how or where you get this long int from.

The manual gives:

     char *ctime(clock)
     long *clock;

     ctime() converts a long integer, pointed to by clock,  to  a
     26-character  string  of the form produced by asctime() . It
     first breaks down clock to a struct  tm  by  calling  local-
     time(),  and  then calls asctime() to convert that struct tm
     to a string.

Which is no help whatsoever.

If it makes any difference I am on a Sun workstation running Un!x...

       The Sorcerer is 'Only visiting this planet' but can be found at:

             JANET: cadx862 @uk.ac.strathclyde.computer-centre-sun 
                    rmacgreg at uk.ac.strathclyde.computer-science
  INTERNET: via nsfnet-relay.ac.uk    BITNET: via ukacrl    UUCP: via ukc.uucp

          or second star to the right and straight on 'till morning.



More information about the Comp.lang.c mailing list