怎么样取到系统时间?

kmajian 2005-03-12 11:17:53
用的IDE是Borland C++ 3.1 ,请问如何取年月日和时间,还请给出个例子,谢谢!
...全文
164 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
jwwu 2005-03-12
  • 打赏
  • 举报
回复
man getdaytime
Dong 2005-03-12
  • 打赏
  • 举报
回复
#include <stdio.h>
#include <time.h>

int main()
{
clock_t start,end;
start = clock();
printf("Please wait a faw seconds and then press any key\n");
fflush(stdout);
getchar();
end = clock();
printf("\nThe interval was %.2f seconds\n", (double)(end - start)/(double)CLOCKS_PER_SEC);
return 0;
}
Dong 2005-03-12
  • 打赏
  • 举报
回复
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main()
{
time_t start,end;
start = time(NULL);
printf("Please wait a faw seconds and then press any key\n");
fflush(stdout);
getchar();
end = time(NULL);
printf("\nThe interval was %.2f seconds\n", difftime(end, start));
return 0;
}
healer_kx 2005-03-12
  • 打赏
  • 举报
回复
SYSTEMTIME st;
GetSystemTime(&st);


st.
yuchengliu 2005-03-12
  • 打赏
  • 举报
回复
/*
Name: waiting.cpp
Copyright:
Author:
Date: 12-03-05 16:24
Description:
*/
#include <iostream>
#include <ctime>
using namespace std;

int main()
{
float secs;
cout << "Enter the delay time, in second:";
cin >> secs;
clock_t delay = secs * CLOCKS_PER_SEC;
cout << "starting...." << endl;
clock_t start = clock();
while( clock() - start < delay )
;
cout << "done" << endl;
system( "pause" );
return 0;
}
zzzzrp 2005-03-12
  • 打赏
  • 举报
回复
mark
murodoch 2005-03-12
  • 打赏
  • 举报
回复
用名字为TIME.H的头文件。然后看帮助
oyljerry 2005-03-12
  • 打赏
  • 举报
回复
GetLocalTime
allen_zhaozhencn 2005-03-12
  • 打赏
  • 举报
回复
GetSystemTime,所取时间为“格林尼治“时间
ltc_mouse 2005-03-12
  • 打赏
  • 举报
回复
#include <dos.h>
#include <stdio.h>

void main(void)
{
struct date curdate;
struct time curtime;
getdate( &curdate );
gettime( &curtime );
printf("Current DateTime: %d/%02d/%02d %02d:%02d:%02d\n",
curdate.da_year, curdate.da_mon, curdate.da_day,
curtime.ti_hour, curtime.ti_min, curtime.ti_sec );
system("Pause");
}

建议楼主多看看编译器的帮助文档,可以获得很多你要的东西~
内容概要:本文提出了一种基于融合鱼鹰算法和柯西变异的改进麻雀优化算法(OCSSA),用于优化变分模态分解(VMD)的参数,进而结合卷积神经网络(CNN)与双向长短期记忆网络(BiLSTM)构建OCSSA-VMD-CNN-BILSTM模型,实现对轴承故障的高【轴承故障诊断】基于融合鱼鹰和柯西变异的麻雀优化算法OCSSA-VMD-CNN-BILSTM轴承诊断研究【西储大学数据】(Matlab代码实现)精度诊断。研究采用西储大学公开的轴承故障数据集进行实验验证,通过优化VMD的模态数和惩罚因子,有效提升了信号分解的准确性与稳定性,随后利用CNN提取故障特征,BiLSTM捕捉时间序列的深层依赖关系,最终实现故障类型的智能识别。该方法在提升故障诊断精度与鲁棒性方面表现出优越性能。; 适合人群:具备一定信号处理、机器学习基础,从事机械故障诊断、智能运维、工业大数据分析等相关领域的研究生、科研人员及工程技术人员。; 使用场景及目标:①解决传统VMD参数依赖人工经验选取的问题,实现参数自适应优化;②提升复杂工况下滚动轴承早期故障的识别准确率;③为智能制造与预测性维护提供可靠的技术支持。; 阅读建议:建议读者结合Matlab代码实现过程,深入理解OCSSA优化机制、VMD信号分解流程以及CNN-BiLSTM网络架构的设计逻辑,重点关注参数优化与故障分类的联动关系,并可通过更换数据集进一步验证模型泛化能力。

65,208

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧