Asterisk - The Open Source Telephony Project
GIT-master-27fb039
Loading...
Searching...
No Matches
main
stdtime
stdtime/test.c
Go to the documentation of this file.
1
/*! \file
2
\brief Testing localtime functionality */
3
4
#include "
localtime.c
"
5
#include <sys/time.h>
6
#include <stdio.h>
7
8
int
main
(
int
argc,
char
**argv) {
9
struct
timeval tv;
10
struct
tm tm;
11
char
*zone[4] = {
"America/New_York"
,
"America/Chicago"
,
"America/Denver"
,
"America/Los_Angeles"
};
12
int
i;
13
14
gettimeofday(&tv,
NULL
);
15
16
for
(i=0;i<4;i++) {
17
ast_localtime
(&tv.tv_sec,&tm,zone[i]);
18
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);
19
}
20
return
0;
21
}
main
int main()
Definition
eagi_proxy.c:107
localtime.c
ast_localtime
struct ast_tm * ast_localtime(const struct timeval *timep, struct ast_tm *p_tm, const char *zone)
Timezone-independent version of localtime_r(3).
Definition
localtime.c:1739
NULL
#define NULL
Definition
resample.c:96
Generated on Wed Oct 29 2025 20:04:25 for Asterisk - The Open Source Telephony Project by
1.9.8