1 | /* |
---|
2 | * This routine is the initialization task of test to exercise some |
---|
3 | * timezone functionality. |
---|
4 | * |
---|
5 | * COPYRIGHT (c) 2007. |
---|
6 | * On-Line Applications Research Corporation (OAR). |
---|
7 | * |
---|
8 | * The license and distribution terms for this file may be |
---|
9 | * found in the file LICENSE in this distribution or at |
---|
10 | * http://www.rtems.com/license/LICENSE. |
---|
11 | */ |
---|
12 | |
---|
13 | #ifdef HAVE_CONFIG_H |
---|
14 | #include "config.h" |
---|
15 | #endif |
---|
16 | |
---|
17 | #define CONFIGURE_INIT |
---|
18 | |
---|
19 | #include <tmacros.h> |
---|
20 | #include <time.h> |
---|
21 | #include <stdlib.h> |
---|
22 | |
---|
23 | void tztester(void) |
---|
24 | { |
---|
25 | struct tm *tm; |
---|
26 | time_t now; |
---|
27 | |
---|
28 | printf("TZ:\"%s\"\n", getenv("TZ")); |
---|
29 | |
---|
30 | time(&now); |
---|
31 | tm = localtime(&now); |
---|
32 | printf ("%4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d\n", |
---|
33 | 1900+tm->tm_year, tm->tm_mon+1, tm->tm_mday, |
---|
34 | tm->tm_hour, tm->tm_min, tm->tm_sec); |
---|
35 | |
---|
36 | tm = gmtime(&now); |
---|
37 | printf ("%4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d\n", |
---|
38 | 1900+tm->tm_year, tm->tm_mon+1, tm->tm_mday, |
---|
39 | tm->tm_hour, tm->tm_min, tm->tm_sec); |
---|
40 | } |
---|
41 | |
---|
42 | rtems_task Init( |
---|
43 | rtems_task_argument argument |
---|
44 | ) |
---|
45 | { |
---|
46 | rtems_time_of_day time; |
---|
47 | rtems_status_code status; |
---|
48 | |
---|
49 | puts( "\n\n*** TIMEZONE TEST ***" ); |
---|
50 | |
---|
51 | build_time( &time, 3, 14, 2007, 15, 9, 26, 5 ); |
---|
52 | status = rtems_clock_set( &time ); |
---|
53 | directive_failed( status, "rtems_clock_set" ); |
---|
54 | |
---|
55 | setenv( "TZ", "CST6CDT,M 3.2.0,M 11.1.0", 1 ); |
---|
56 | |
---|
57 | tzset(); |
---|
58 | |
---|
59 | tztester(); |
---|
60 | |
---|
61 | puts( "*** END OF TIMEZONE TEST ***" ); |
---|
62 | exit(0); |
---|
63 | } |
---|
64 | |
---|
65 | |
---|
66 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
---|
67 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
---|
68 | |
---|
69 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
---|
70 | #define CONFIGURE_MAXIMUM_TASKS 1 |
---|
71 | |
---|
72 | #include <rtems/confdefs.h> |
---|