Back to index

glibc  2.9
Defines | Functions | Variables
tst-strptime2.c File Reference
#include <limits.h>
#include <stdio.h>
#include <time.h>

Go to the source code of this file.

Defines

#define ntests   (sizeof (tests) / sizeof (tests[0]))

Functions

int main (void)

Variables

struct {
const char * fmt
long int gmtoff
tests []

Define Documentation

#define ntests   (sizeof (tests) / sizeof (tests[0]))

Definition at line 26 of file tst-strptime2.c.


Function Documentation

int main ( void  )

Definition at line 30 of file tst-strptime2.c.

{
  int result = 0;

  for (int i = 0; i < ntests; ++i)
    {
      struct tm tm;

      if (strptime (tests[i].fmt, "%s %z", &tm) == NULL)
       {
         if (tests[i].gmtoff != LONG_MAX)
           {
             printf ("round %d: strptime unexpectedly failed\n", i);
             result = 1;
           }
         continue;
       }

      if (tm.tm_gmtoff != tests[i].gmtoff)
       {
         printf ("round %d: tm_gmtoff is %ld\n", i, (long int) tm.tm_gmtoff);
         result = 1;
       }
    }

  if (result == 0)
    puts ("all OK");

  return 0;
}

Here is the call graph for this function:


Variable Documentation

struct { ... } tests[] [static]