packages icon



 date_parse(3)                                                 date_parse(3)
                              11 February 1995



 NAME
      date_parse - parse string dates into internal form

 SYNOPSIS
      time_t date_parse( char* str )

 DESCRIPTION
      Parses a date string into standard Unix internal time form (seconds
      since epoch).  The date should be in one of the following formats:
          N mth YYYY HH:MM:SS ampm zone
          HH:MM:SS ampm zone N mth YYYY
          wdy, N mth YYYY HH:MM:SS ampm zone
          wdy mth N HH:MM:SS ampm zone YYYY
          N mth YYYY
          HH:MM:SS ampm
      No-zone, no-seconds, and no-am/pm versions of each are also allowed.
      Any missing parts default to the current date/time.  Note that
      dd/mm/yy and mm/dd/yy are not supported - those formats are dumb.

 SPEED
      The implementation is just a bunch of sscanf's - small and portable,
      but slow.  Still, it's not that bad.  On a SPARCstation 2 parsing
      ~70000 random dates, the average time was 0.94 msec/date.  This
      compares surprising well with the lex-based date parser from the MH
      package, which took 0.34 msec/date in the same test.  The yacc-based
      parser used in many netnews packages is about halfway between the two.

      In any application which has to open a file for each date - and both
      MH and netnews are such applications - the difference in date parsing
      speed will not be perceptible to the user.

 SEE ALSO
      date_sort(1), date_order(1), deltime(1), xmit_time(1)

 AUTHOR
      Copyright (C) 1995 by Jef Poskanzer <jef@acme.com>.  All rights
      reserved.

















                                    - 1 -      Formatted:  December 21, 2024