关于时间转换可以参考以下博客:

https://www.jianshu.com/p/80de04b41c31

https://www.cnblogs.com/qicosmos/p/3642712.html

https://blog.csdn.net/wizardtoh/article/details/81738682

https://blog.csdn.net/hou8389846/article/details/77962343

get_time put_time相关

https://blog.csdn.net/wangjieest/article/details/7761051

https://www.yiibai.com/cpp_standard_library/cpp_get_time.html

time_point 相关

https://www.xuebuyuan.com/716692.html?mobile=1

hdu 6491

时间间隔

Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 153    Accepted Submission(s): 96

Problem Description
2019年1月1日,在云栖出现了可能是全世界最长的以秒为单位的倒计时装置:九亿多秒倒计时,直到2050年。

给出一个时间S,我们想知道S距离2050年1月1日0点0时0分多少秒。

因为答案可能很大,请输出答案模100的值。

 
Input
第一行一个正整数 T (1≤T≤100000)

表示数据组数。

对于每组数据,一行一个字符串表示时间。
时间格式为:YYYY-MM-DD HH:MM:SS,分别表示年、月、日、时,分、秒。

输入的时间保证都在2019年1月1日以后(包含当天)。

 
Output
对于每组数据输出一行一个整数表示答案。
 
Sample Input
1
2019-01-01 00:00:00
 
Sample Output
0
 
 
#include<bits/stdc++.h>
using namespace std; int main()
{
string s;
stringstream ss;
s = "2050-01-01 00:00:00";
ss << s;
tm beg ;
ss >> get_time(&beg,"%Y-%m-%d");
ss >> get_time(&beg,"%H:%M:%S");
auto next_time = chrono::system_clock::from_time_t(time_t(mktime(&beg)));
int n;
cin>>n;
while(n--)
{
tm ed;
cin >> get_time(&ed,"%Y-%m-%d");
cin >> get_time(&ed,"%H:%M:%S");
auto from_time = chrono::system_clock::from_time_t(time_t(mktime(&ed)));
auto diff = next_time - from_time ;
cout<<abs(chrono::duration_cast<chrono::seconds>(diff).count())%<<endl;
}
return ;
}

最新文章

  1. 常用Linux命令收集
  2. 持续集成及部署利器:Go
  3. Java编程中“为了性能”需做的26件事
  4. .NET技术大系概览 (迄今为止最全的.NET技术栈)
  5. ctrip
  6. Python读取文本,输出指定中文(字符串)
  7. Docker 存储设置
  8. PHPCMS V9 点击量排行调用方法
  9. debian和ubuntu的sh dash bash
  10. LintCode &quot;The Smallest Difference&quot;
  11. cocos2d-x创建工程批处理
  12. #include &lt;fstream&gt;
  13. 《linux内核完全剖析》笔记03-进程创建
  14. 巧用weui.gallery(),点击图片后预览图片
  15. Integer自动装箱拆箱bug,创建对象在-128到127
  16. 开源免费的C/C++网络库(c/c++ sockets library)补充
  17. 如何用vue实现树形菜单?
  18. ES6常用知识点小结
  19. TCP连接建立系列 — 客户端的端口选取和重用
  20. MySQL之内连接、左连接和右连接

热门文章

  1. Dom解析XML文件具体用法
  2. C++学习之路(十一):C++的初始化列表
  3. Windows版Oracle重建EM---备注
  4. 学习记录:mongodb里插入整型值
  5. 数据结构之线性表(python版)
  6. Zookeeper安装以及配置说明(三)
  7. SQL2000数据库修改sa密码
  8. Java读取本地文件(输入流)
  9. C语言-删除注释
  10. 更改Chrome浏览器安装位置的方法