爱上C之:time

Posted 纯原创,零转载

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了爱上C之:time相关的知识,希望对你有一定的参考价值。

Show_Current_Time:

 1 #include <time.h>
 2 #include <stdio.h>
 3 
 4 int main(void)
 5 {
 6     char* weekday[] = {"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};
 7     time_t Now = time(NULL);
 8     struct tm* Tvar = localtime(&Now);
 9     printf("Current time is : %4i-%02i-%02i[%s] %02i:%02i:%02i\n", Tvar->tm_year + 1900, Tvar->tm_mon + 1, Tvar->tm_mday, weekday[Tvar->tm_wday], Tvar->tm_hour, Tvar->tm_min, Tvar->tm_sec);
10     return 0;
11 }
[email protected] ~/cc $ ./time_Now 
Current time is : 2016-10-15[Saturday] 13:08:55
技术分享localtime(time_t *)

 

以上是关于爱上C之:time的主要内容,如果未能解决你的问题,请参考以下文章

爱上C之:API for Mysql

1 代码片段1

“让开发者爱上安全测试”系列之“源码安全测试”——开发者之伤

爱上C之:自制hexdump「二进制字节码查看」

apriori片段代码

A 8b Time-Interleaved Time-Domain ADC with Input-Independent Background Timing Skew Calibration(代码片段