import timefunc_count_time_dict = {}def count_time(func): global func_count_time_dict func_count_time_dict[func]=[1,time.localtime()] def wra...
分类:
编程语言 时间:
2015-07-20 01:16:51
阅读次数:
253
介绍localtime非信号安全,并且在多线程下,fork子进程出现死锁的原因...
分类:
编程语言 时间:
2015-07-17 19:03:51
阅读次数:
189
在做银行系统的过程中,想到一个功能,记录每一位用户的操作,即用户的日志。此时需要用到ctime库来获取当前的系统时间。
获取时间的源码如下:
time_t curtime=time(0);
tm tim =*localtime(&curtime);
int day,mon,year;
int hour,min,sec;
string time;
...
分类:
编程语言 时间:
2015-07-16 09:54:03
阅读次数:
163
http://net.pku.edu.cn/~yhf/linux_c/function/04.html asctime(将时间和日期以字符串格式表示)相关函数time,ctime,gmtime,localtime表头文件#include定义函数char * asctime(const struct ...
分类:
编程语言 时间:
2015-07-14 22:13:31
阅读次数:
223
/*time_h的使用*///第一种方式time_ttimer1;time(&timer1);//第二种方式time_ttimer2;timer2=time(NULL);//第三种方式time_ttimer3=time(NULL);/*structtm的使用*/structtm*now;timer_ttimer=time(NULL);now=localtime(&timer);printf("%s\n",asctime(now));printf("%0..
分类:
其他好文 时间:
2015-07-10 17:02:18
阅读次数:
102
新装的CentOS系统服务器可能设置了错误的,需要调整时区并调整时间.如下是CentOS系统使用NTP来从一个时间服务器同步:
第一步: 把当前时区调整为上海就是+8区,想改其他时区也可以去看看/usr/share/zoneinfo目录;
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
...
分类:
其他好文 时间:
2015-07-08 09:34:27
阅读次数:
94
查看时区//cat/etc/localtime[root@wode002~]#cat/etc/localtimeTZif?\???‘p?????Z??6ip~h?!Iap"^J?#)Cp$Gg%_?&‘I&?A?(+(?#?~?p?CDTCSTTZif2????~6C)?????\???????‘p?????????????Z??6ip~h?!Iap"^J?#)Cp$Gg%_?&‘I&?A?(+(?#?q?~?pLMTCDTCSTCST-8[root@wode002~]..
分类:
其他好文 时间:
2015-06-30 18:43:51
阅读次数:
99
1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 int main() 7 { 8 time_t ti = time(NULL); 9 struct tm* timer = localtime(&ti)...
分类:
其他好文 时间:
2015-06-26 19:29:18
阅读次数:
145
localtime(取得当地目前时间和日期)【头文件】#include 【函数原型】struct tm *localtime(const time_t * timep);【函数说明】localtime()将参数 timep 所指的 time_t 结构中的信息转换成真实世界所使用的时间日期表示方法,然...
分类:
其他好文 时间:
2015-06-26 17:47:40
阅读次数:
113
一、获取时间
struct tm *tm;
time_t timep;
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
time(&timep);
#else
struct timeval tv;
gettimeofday(&tv, NULL);
timep = tv.tv_sec;
#endif
tm = localtime(&...
分类:
其他好文 时间:
2015-06-16 19:15:20
阅读次数:
90