[comp.unix.questions] ASCII-->internal time

mark@drd.UUCP (Mark Lawrence) (06/09/89)

    I've recently been considering what to use for an internal format
    for date/time stamps.  The system I'm am developing receives
    date/time stamped records from an external source.  The stamp is in
    a consistent ascii format.  
    
    I've been reviewing ctime, et al and note that they are good for 
    converting UNIX internal time format into ascii and struct tm but 
    don't provide a way to convert from ascii or struct tm back to UNIX 
    internal format.  I don't see a cousin which has that functionality
    in the man pages, either.  Am I missing something here?  I'd like to
    be able to pick apart the stamp on the data, plug it into a variable
    of type struct tm and then have it womped into UNIX internal format
    (for storage efficiency).  

--
Hierarchical Earthers: lawrence@tusun2.knet.UTulsa.Edu
        Flat Earthers: {...uunet!apctrc,...rutgers!okstate!romed}!drd!mark
         Emailophobes: (918) 743-3013

wk@hpirs.HP.COM (Wayne Krone) (06/13/89)

>     I've been reviewing ctime, et al and note that they are good for 
>     converting UNIX internal time format into ascii and struct tm but 
>     don't provide a way to convert from ascii or struct tm back to UNIX 
>     internal format.  I don't see a cousin which has that functionality

The draft standard for ANSI C defines a function mktime() which converts
a tm structure into a time_t value (time_t is the type ANSI C defines to
be returned by the time() function).

Wayne Krone