Back to index

glibc  2.9
Defines | Functions | Variables
strptime_l.c File Reference
#include <assert.h>
#include <ctype.h>
#include <langinfo.h>
#include <limits.h>
#include <string.h>
#include <time.h>
#include <stdbool.h>

Go to the source code of this file.

Defines

#define localtime_r   my_localtime_r
#define match_char(ch1, ch2)   if (ch1 != ch2) return NULL
#define match_string(cs1, s2)   (strncasecmp ((cs1), (s2), strlen (cs1)) ? 0 : ((s2) += strlen (cs1), 1))
#define get_number(from, to, n)
#define get_alt_number(from, to, n)
#define recursive(new_fmt)
#define HERE_D_T_FMT   "%a %b %e %H:%M:%S %Y"
#define HERE_D_FMT   "%m/%d/%y"
#define HERE_AM_STR   "AM"
#define HERE_PM_STR   "PM"
#define HERE_T_FMT_AMPM   "%I:%M:%S %p"
#define HERE_T_FMT   "%H:%M:%S"
#define LOCALE_PARAM
#define LOCALE_ARG
#define LOCALE_PARAM_DECL
#define LOCALE_PARAM_PROTO
#define HELPER_LOCALE_ARG
#define ISSPACE(Ch)   isspace (Ch)
#define __isleap(year)   ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))

Functions

static struct tmlocaltime_r (const time_t *, struct tm *)
static struct tmlocaltime_r (time_t *t, struct tm *tp) const
static void day_of_the_week (struct tm *tm)
static void day_of_the_year (struct tm *tm)
static char * __strptime_internal (rp, fmt, tmp, statep LOCALE_PARAM) const char *rp

Variables

static char const weekday_name [][10]
static char const ab_weekday_name [][4]
static char const month_name [][10]
static char const ab_month_name [][4]
static const unsigned short int __mon_yday [2][13]
const char * fmt
struct tmtmp
void * statep
const char * format
struct tmtm

Define Documentation

#define __isleap (   year)    ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))

Definition at line 207 of file strptime_l.c.

#define get_alt_number (   from,
  to,
  n 
)
Value:
/* We don't have the alternate representation.  */                          \
  get_number(from, to, n)

Definition at line 111 of file strptime_l.c.

#define get_number (   from,
  to,
  n 
)
Value:
do {                                                                 \
    int __n = n;                                                     \
    val = 0;                                                         \
    while (*rp == ' ')                                                      \
      ++rp;                                                          \
    if (*rp < '0' || *rp > '9')                                             \
      return NULL;                                                   \
    do {                                                             \
      val *= 10;                                                     \
      val += *rp++ - '0';                                            \
    } while (--__n > 0 && val * 10 <= to && *rp >= '0' && *rp <= '9');             \
    if (val < from || val > to)                                             \
      return NULL;                                                   \
  } while (0)

Definition at line 72 of file strptime_l.c.

Definition at line 197 of file strptime_l.c.

#define HERE_AM_STR   "AM"

Definition at line 160 of file strptime_l.c.

#define HERE_D_FMT   "%m/%d/%y"

Definition at line 159 of file strptime_l.c.

#define HERE_D_T_FMT   "%a %b %e %H:%M:%S %Y"

Definition at line 158 of file strptime_l.c.

#define HERE_PM_STR   "PM"

Definition at line 161 of file strptime_l.c.

#define HERE_T_FMT   "%H:%M:%S"

Definition at line 163 of file strptime_l.c.

#define HERE_T_FMT_AMPM   "%I:%M:%S %p"

Definition at line 162 of file strptime_l.c.

#define ISSPACE (   Ch)    isspace (Ch)

Definition at line 198 of file strptime_l.c.

#define LOCALE_ARG

Definition at line 194 of file strptime_l.c.

#define LOCALE_PARAM

Definition at line 193 of file strptime_l.c.

Definition at line 195 of file strptime_l.c.

Definition at line 196 of file strptime_l.c.

#define localtime_r   my_localtime_r

Definition at line 41 of file strptime_l.c.

#define match_char (   ch1,
  ch2 
)    if (ch1 != ch2) return NULL

Definition at line 58 of file strptime_l.c.

#define match_string (   cs1,
  s2 
)    (strncasecmp ((cs1), (s2), strlen (cs1)) ? 0 : ((s2) += strlen (cs1), 1))

Definition at line 67 of file strptime_l.c.

#define recursive (   new_fmt)
Value:
(*(new_fmt) != '\0'                                                  \
   && (rp = __strptime_internal (rp, (new_fmt), tm, &s LOCALE_ARG)) != NULL)

Definition at line 115 of file strptime_l.c.


Function Documentation

static char* __strptime_internal ( rp  ,
fmt  ,
tmp  ,
statep  LOCALE_PARAM 
) const [static]
static void day_of_the_week ( struct tm tm) [static]

Definition at line 213 of file strptime_l.c.

{
  /* We know that January 1st 1970 was a Thursday (= 4).  Compute the
     the difference between this data in the one on TM and so determine
     the weekday.  */
  int corr_year = 1900 + tm->tm_year - (tm->tm_mon < 2);
  int wday = (-473
             + (365 * (tm->tm_year - 70))
             + (corr_year / 4)
             - ((corr_year / 4) / 25) + ((corr_year / 4) % 25 < 0)
             + (((corr_year / 4) / 25) / 4)
             + __mon_yday[0][tm->tm_mon]
             + tm->tm_mday - 1);
  tm->tm_wday = ((wday % 7) + 7) % 7;
}
static void day_of_the_year ( struct tm tm) [static]

Definition at line 231 of file strptime_l.c.

{
  tm->tm_yday = (__mon_yday[__isleap (1900 + tm->tm_year)][tm->tm_mon]
               + (tm->tm_mday - 1));
}
static struct tm* localtime_r ( const time_t ,
struct tm  
) [static, read]
static struct tm* localtime_r ( time_t t,
struct tm tp 
) const [static, read]

Definition at line 44 of file strptime_l.c.

{
  struct tm *l = localtime (t);
  if (! l)
    return 0;
  *tp = *l;
  return tp;
}

Here is the call graph for this function:


Variable Documentation

const unsigned short int __mon_yday[2][13] [static]
Initial value:
  {
    
    { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
    
    { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
  }

Definition at line 165 of file strptime_l.c.

char const ab_month_name[][4] [static]
Initial value:
  {
    "Jan", "Feb", "Mar", "Apr", "May", "Jun",
    "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
  }

Definition at line 153 of file strptime_l.c.

char const ab_weekday_name[][4] [static]
Initial value:
  {
    "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
  }

Definition at line 144 of file strptime_l.c.

const char* fmt

Definition at line 246 of file strptime_l.c.

const char* format

Definition at line 1210 of file strptime_l.c.

char const month_name[][10] [static]
Initial value:
  {
    "January", "February", "March", "April", "May", "June",
    "July", "August", "September", "October", "November", "December"
  }

Definition at line 148 of file strptime_l.c.

void* statep

Definition at line 248 of file strptime_l.c.

struct tm* tm

Definition at line 1212 of file strptime_l.c.

struct tm* tmp

Definition at line 247 of file strptime_l.c.

char const weekday_name[][10] [static]
Initial value:
  {
    "Sunday", "Monday", "Tuesday", "Wednesday",
    "Thursday", "Friday", "Saturday"
  }

Definition at line 139 of file strptime_l.c.