Asterisk.org: Developer Documentation (28 Oct 2009)

Wed Oct 28 15:49:22 2009

## Asterisk developer's documentation

# test.c File Reference

Testing localtime functionality. More...

`#include "localtime.c"`
`#include <sys/time.h>`
`#include <stdio.h>`

Include dependency graph for test.c:

Go to the source code of this file.

## Functions

int | main (int argc, char **argv)

## Detailed Description

Testing localtime functionality.

Definition in file test.c.

## Function Documentation

int main | ( | int | argc,
|  | char ** | argv |
| ) |  |  |

Definition at line 8 of file test.c.

References ast_localtime().

    00008                                 {
    00009    struct timeval tv;
    00010    struct tm   tm;
    00011    char  *zone[4] = { "America/New_York", "America/Chicago", "America/Denver", "America/Los_Angeles" };
    00012    int   i;
    00013
    00014    gettimeofday(&tv,NULL);
    00015
    00016    for (i=0;i<4;i++) {
    00017       ast_localtime(&tv.tv_sec,&tm,zone[i]);
    00018       printf("Localtime at %s is %04d/%02d/%02d %02d:%02d:%02d\n",zone[i],tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
    00019    }
    00020    return 0;
    00021 }