Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

C Exercise 91

C Exercise 91

100 Classic C Language Examples 100 Classic C Language Examples

**Problem:** Time function example 1

**Analysis:** None.

Program source code:



//  Created by www.runoob.com on 15/11/9.

//  Copyright © 2015 Runoob Tutorial. All rights reserved.

//



#include 

#include 



int main ()

{

    time_t rawtime;

    struct tm * timeinfo;

    

    time ( &rawtime );

    timeinfo = localtime ( &rawtime );

    printf ( "当前本地时间为: %s", asctime (timeinfo) );

    

    return 0;

}

The above example produces the following output:



当前本地时间为: Tue Nov 10 16:28:49 2015

100 Classic C Language Examples 100 Classic C Language Examples