社区
工具平台和程序库
帖子详情
关于时间?
gxy19830818
2004-04-11 07:44:19
请问各位老大,在c++里用哪一个函数获得系统的时间?
...全文
108
6
打赏
收藏
关于时间?
请问各位老大,在c++里用哪一个函数获得系统的时间?
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
6 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
gxy19830818
2004-04-16
打赏
举报
回复
谢谢各位了,结贴
httruly
2004-04-14
打赏
举报
回复
学习
lyzq
2004-04-13
打赏
举报
回复
SYSTEMTIME st;
GetSystemTime(&st);
hslinux
2004-04-13
打赏
举报
回复
装个VC&MSDN,什么都知道了。
happlyman
2004-04-11
打赏
举报
回复
#include <time.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/timeb.h>
#include <string.h>
int main(int argc, char* argv[])
{
char tmpbuf[128], ampm[] = "AM";
time_t ltime;
struct _timeb tstruct;
struct tm *today, *gmt, xmas = { 0, 0, 12, 25, 11, 93 };
_tzset();
_strtime( tmpbuf );
printf( "OS time:\t\t\t\t%s\n", tmpbuf );
_strdate( tmpbuf );
printf( "OS date:\t\t\t\t%s\n", tmpbuf );
time( <ime );
printf( "Time in seconds since UTC 1/1/70:\t%ld\n", ltime );
printf( "UNIX time and date:\t\t\t%s", ctime( <ime ) );
gmt = gmtime( <ime );
printf( "Coordinated universal time:\t\t%s", asctime( gmt ) );
today = localtime( <ime );
if( today->tm_hour > 12 )
{
strcpy( ampm, "PM" );
today->tm_hour -= 12;
}
if( today->tm_hour == 0 ) /* Adjust if midnight hour. */
today->tm_hour = 12;
printf( "12-hour time:\t\t\t\t%.8s %s\n",
asctime( today ) + 11, ampm );
_ftime( &tstruct );
printf( "Plus milliseconds:\t\t\t%u\n", tstruct.millitm );
printf( "Zone difference in seconds from UTC:\t%u\n",
tstruct.timezone );
printf( "Time zone name:\t\t\t\t%s\n", _tzname[0] );
printf( "Daylight savings:\t\t\t%s\n",
tstruct.dstflag ? "YES" : "NO" );
if( mktime( &xmas ) != (time_t)-1 )
printf( "Christmas\t\t\t\t%s\n", asctime( &xmas ) );
today = localtime( <ime );
strftime( tmpbuf, 128,
"Today is %A, day %d of %B in the year %Y.\n", today );
printf( tmpbuf );
return 0;
}
rorot
2004-04-11
打赏
举报
回复
#include <ctime>
#include <iostream>
using namespace std;
int main()
// 时间
{
time_t t0;
time( &t0 );
tm *t1 = localtime(&t0);
cout << t1->tm_year+1900 << endl;
cout << t1->tm_mon+1 << endl;
cout << t1->tm_mday << endl;
cout << t1->tm_hour << endl;
return 0;
}
高级互联网架构:美团分布式任务调度平台XXL-JOB
3、不重启服务的情况如何动态地调整定时任务的执行
时间
? 4、部署定时任务的机器发生故障如何实现故障转移? 5、如何对定时任务进行监控? 6、业务量比较大,单机性能的瓶颈问题,如何扩展? 7、分布式任务调度如果...
什么是
时间
复杂度?
时间
复杂度(Time complexity)是一个函数,它定性描述该算法的运行
时间
。这是一个代表算法输入值的字符串的长度的函数.
时间
复杂度常用大O表述,不包括这个函数的低阶项和首项系数。 常见的
时间
复杂度 常见...
Windows 10右下角系统
时间
如何显示长
时间
?年月日时分秒?星期几?
Windows 10右下角系统
时间
如何显示长
时间
?年月日时分秒?第一步:我们先Windows+R打开运行窗口,然后输入“control”打开控制面板,我们选择“区域”项点击。 △ 点击“区域”项 在"区域"窗口中,点击"短日期"的...
如何修改图片的创建
时间
和修改
时间
?
如何修改图片的创建
时间
和修改
时间
?下面我就来为大家介绍详细的操作步骤吧,即使有大量的图片需要修改也能快速完成,一起来学习。
一套图 搞懂“
时间
复杂度”
是我到目前为止所看到的关于
时间
复杂度介绍的最好的文章,简介 清晰 明了。 所以拿来po出来 仅供学习交流,如侵则删。 现已将此文收录至:《数据结构》C语言版 (清华严蔚敏考研版) 全书知识梳理 正文: ...
工具平台和程序库
24,854
社区成员
27,343
社区内容
发帖
与我相关
我的任务
工具平台和程序库
C/C++ 工具平台和程序库
复制链接
扫一扫
分享
社区描述
C/C++ 工具平台和程序库
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章