LinuxGuruz
  • Last 5 Forum Topics
    Replies
    Views
    Last post


The Web Only This Site
  • BOOKMARK

  • ADD TO FAVORITES

  • REFERENCES


  • MARC

    Mailing list ARChives
    - Search by -
     Subjects
     Authors
     Bodies





    FOLDOC

    Computing Dictionary




  • Text Link Ads






  • LINUX man pages
  • Linux Man Page Viewer


    The following form allows you to view linux man pages.

    Command:

    getdate_r

    
    
    
    

    SYNOPSIS

           #include <time.h>
    
           struct tm *getdate(const char *string);
    
           extern int getdate_err;
    
           #include <time.h>
    
           int getdate_r(const char *string, struct tm *res);
    
       Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
    
           getdate():
               _XOPEN_SOURCE >= 500 || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
           getdate_r():
               _GNU_SOURCE
    
    
    

    DESCRIPTION

           The function getdate() converts a string representation of a  date  and
           time,  contained in the buffer pointed to by string, into a broken-down
           time.  The broken-down time is stored in a tm structure, and a  pointer
           to  this  structure is returned as the function result.  This tm struc-
           ture is allocated in static storage, and consequently it will be  over-
           written by further calls to getdate().
    
           In  contrast  to  strptime(3), (which has a format argument), getdate()
           uses the formats found in the file whose full pathname is given in  the
           environment  variable DATEMSK.  The first line in the file that matches
           the given input string is used for the conversion.
    
           The matching  is  done  case  insensitively.   Superfluous  whitespace,
           either in the pattern or in the string to be converted, is ignored.
    
           The  conversion  specifications  that  a  pattern can contain are those
           given for strptime(3).  One more conversion specification is  specified
           in POSIX.1-2001:
    
           %Z     Timezone name.  This is not implemented in glibc.
    
           When %Z is given, the structure containing the broken-down time is ini-
           tialized with values corresponding to the current  time  in  the  given
           timezone.   Otherwise,  the structure is initialized to the broken-down
           time corresponding to the current local time (as by a  call  to  local-
           time(3)).
    
           When  only  the  day  of  the week is given, the day is taken to be the
           first such day on or after today.
    
           When only the month is given (and no year), the month is  taken  to  be
           the first such month equal to or after the current month.  If no day is
    
    
    

    RETURN VALUE

           When successful, getdate() returns a pointer to a  struct  tm.   Other-
           wise,  it  returns NULL and sets the global variable getdate_err to one
           of the error numbers shown below.  Changes to errno are unspecified.
    
           On success getdate_r() returns 0; on error it returns one of the  error
           numbers shown below.
    
    
    

    ERRORS

           The following errors are returned via getdate_err (for getdate()) or as
           the function result (for getdate_r()):
    
           1   The DATEMSK environment variable is not defined, or its value is an
               empty string.
    
           2   The  template  file specified by DATEMSK cannot be opened for read-
               ing.
    
           3   Failed to get file status information.
    
           4   The template file is not a regular file.
    
           5   An error was encountered while reading the template file.
    
           6   Memory allocation failed (not enough memory available).
    
           7   There is no line in the file that matches the input.
    
           8   Invalid input specification.
    
    
    

    ENVIRONMENT

           DATEMSK
                  File containing format patterns.
    
           TZ, LC_TIME
                  Variables used by strptime(3).
    
    
    

    ATTRIBUTES

       Multithreading (see pthreads(7))
           The getdate() function is not thread-safe.
    
           The getdate_r() function is thread-safe.
    
    
    

    CONFORMING TO

           POSIX.1-2001.
    
    
    

    NOTES

           The POSIX.1-2001  specification  for  strptime(3)  contains  conversion
           specifications  using  the %E or %O modifier, while such specifications
           are not given for getdate().  In glibc, getdate() is implemented  using
           strptime(3),  so  that  precisely the same conversions are supported by
           both.
               Sun Sep  7 06:03:36 CEST 2008
               Call 1 ("Tuesday") succeeded:
                   tm_sec   = 36
                   tm_min   = 3
                   tm_hour  = 6
                   tm_mday  = 9
                   tm_mon   = 8
                   tm_year  = 108
                   tm_wday  = 2
                   tm_yday  = 252
                   tm_isdst = 1
               Call 2 ("2009-12-28") succeeded:
                   tm_sec   = 36
                   tm_min   = 3
                   tm_hour  = 6
                   tm_mday  = 28
                   tm_mon   = 11
                   tm_year  = 109
                   tm_wday  = 1
                   tm_yday  = 361
                   tm_isdst = 0
               Call 3 ("12:22:33") succeeded:
                   tm_sec   = 33
                   tm_min   = 22
                   tm_hour  = 12
                   tm_mday  = 7
                   tm_mon   = 8
                   tm_year  = 108
                   tm_wday  = 0
                   tm_yday  = 250
                   tm_isdst = 1
    
       Program source
    
           #define _GNU_SOURCE 500
           #include <time.h>
           #include <stdio.h>
           #include <stdlib.h>
    
           int
           main(int argc, char *argv[])
           {
               struct tm *tmp;
               int j;
    
               for (j = 1; j < argc; j++) {
                   tmp = getdate(argv[j]);
    
                   if (tmp == NULL) {
                       printf("Call %d failed; getdate_err = %d\n",
                              j, getdate_err);
                       continue;
    
               exit(EXIT_SUCCESS);
           }
    
    
    

    SEE ALSO

           time(2), localtime(3), setlocale(3), strftime(3), strptime(3)
    
                                      2014-01-17                        GETDATE(3)
    
  • MORE RESOURCE


  • Linux

    The Distributions





    Linux

    The Software





    Linux

    The News



  • MARKETING






  • Toll Free

webmaster@linuxguruz.com
Copyright © 1999 - 2016 by LinuxGuruz