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 | * $Id$ |
---|
13 | */ |
---|
14 | |
---|
15 | #define CONFIGURE_INIT |
---|
16 | |
---|
17 | #include <tmacros.h> |
---|
18 | #include <time.h> |
---|
19 | #include <stdlib.h> |
---|
20 | |
---|
21 | void tztester(void) |
---|
22 | { |
---|
23 | struct tm *tm; |
---|
24 | time_t now; |
---|
25 | |
---|
26 | printf("TZ:\"%s\"\n", getenv("TZ")); |
---|
27 | |
---|
28 | time(&now); |
---|
29 | tm = localtime(&now); |
---|
30 | printf ("%4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d\n", |
---|
31 | 1900+tm->tm_year, tm->tm_mon+1, tm->tm_mday, |
---|
32 | tm->tm_hour, tm->tm_min, tm->tm_sec); |
---|
33 | |
---|
34 | tm = gmtime(&now); |
---|
35 | printf ("%4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d\n", |
---|
36 | 1900+tm->tm_year, tm->tm_mon+1, tm->tm_mday, |
---|
37 | tm->tm_hour, tm->tm_min, tm->tm_sec); |
---|
38 | } |
---|
39 | |
---|
40 | rtems_task Init( |
---|
41 | rtems_task_argument argument |
---|
42 | ) |
---|
43 | { |
---|
44 | rtems_time_of_day time; |
---|
45 | rtems_status_code status; |
---|
46 | |
---|
47 | puts( "\n\n*** TIMEZONE TEST ***" ); |
---|
48 | |
---|
49 | build_time( &time, 3, 14, 2007, 15, 9, 26, 5 ); |
---|
50 | status = rtems_clock_set( &time ); |
---|
51 | directive_failed( status, "rtems_clock_set" ); |
---|
52 | |
---|
53 | setenv( "TZ", "CST6CDT,M 3.2.0,M 11.1.0", 1 ); |
---|
54 | |
---|
55 | tzset(); |
---|
56 | |
---|
57 | tztester(); |
---|
58 | |
---|
59 | puts( "*** END OF TIMEZONE TEST ***" ); |
---|
60 | exit(0); |
---|
61 | } |
---|
62 | |
---|
63 | |
---|
64 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
---|
65 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
---|
66 | |
---|
67 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
---|
68 | #define CONFIGURE_MAXIMUM_TASKS 1 |
---|
69 | |
---|
70 | #include <rtems/confdefs.h> |
---|