1-1.c revision 2c28215423293e443469a07ae7011135d058b671
1/*
2 * Copyright (c) 2003, Intel Corporation. All rights reserved.
3 * Created by:  majid.awad REMOVE-THIS AT intel DOT com
4 * This file is licensed under the GPL license.  For the full content
5 * of this license, see the COPYING file at the top level of this
6 * source tree.
7 *
8 *
9 * This test shall return a pointer to the tm structure when converting
10 * a time value to a broken down local time.
11 */
12
13#include <stdio.h>
14#include <time.h>
15#include "posixtest.h"
16
17int main() {
18    time_t current_time;
19    struct tm *timeptr;
20
21    current_time = time(NULL);
22    timeptr = NULL;
23    timeptr = localtime(&current_time);
24
25    if (timeptr != NULL) {
26	    printf("date: %s", (asctime(localtime((&current_time)))));
27	    puts("Test PASSED");
28	    return PTS_PASS;
29    } else {
30	    puts("Test FAILED: localtime failed");
31	    return PTS_FAIL;
32    }
33}