c++ time_t
struct tm
Structure containing a calendar date and time broken down into its components.
The structure contains nine members of type int, which are (in any order):
|
int tm_sec; |
struct tm
{
int tm_sec; /*秒,正常范围0-59, 但允许至61*/
int tm_min; /*分钟,0-59*/
int tm_hour; /*小时, 0-23*/
int tm_mday; /*日,即一个月中的第几天,1-31*/
int tm_mon; /*月, 从一月算起,0-11*/ 1+p->tm_mon;
int tm_year; /*年, 从1900至今已经多少年*/ 1900+ p->tm_year;
int tm_wday; /*星期,一周中的第几天, 从星期日算起,0-6*/
int tm_yday; /*从今年1月1日到目前的天数,范围0-365*/
int tm_isdst; /*日光节约时间的旗标*/
};
需要特别注意的是,年份是从1900年起至今多少年,而不是直接存储如2011年,月份从0开始的,0表示一月,星期也是从0开始的, 0表示星期日,1表示星期一。
The meaning of each is:
| Member | Meaning | Range |
|---|---|---|
| tm_sec | seconds after the minute | 0-61* |
| tm_min | minutes after the hour | 0-59 |
| tm_hour | hours since midnight | 0-23 |
| tm_mday | day of the month | 1-31 |
| tm_mon | months since January | 0-11: real month = tm_mon + 1 |
| tm_year | years since 1900 | 1900+tm_year |
| tm_wday | days since Sunday | 0-6 |
| tm_yday | days since January 1 | 0-365 |
| tm_isdst | Daylight Saving Time flag |
The Daylight Saving Time flag (tm_isdst) is greater than zero if Daylight Saving Time is in effect, zero if Daylight Saving Time is not in effect, and less than zero if the information is not available.
* tm_sec is generally 0-59. Extra range to accommodate for leap seconds in certain systems.
c++ time_t的更多相关文章
- C语言中两种方式表示时间日期值time_t和struct tm类型的相互转换
使用gmtime函数或localtime函数将time_t类型的时间日期转换为structtm类型: 使用time函数返回的是一个long值,该值对用户的意义不大,一般不能根据其值确定具体的年.月.日 ...
- c++ 时间类型详解 time_t
Unix时间戳(Unix timestamp),或称Unix时间(Unix time).POSIX时间(POSIX time),是一种时间表示方式,定义为从格林威治时间1970年01月01日00时00 ...
- time_t 获取的是UCT时间,有时差
int main() { time_t nowTime; time(&nowTime);//获取当前时间(世界时间)//这种写法也一样nowTime=time(NULL) ; //如果要转化为 ...
- c time_t 和 oc NSDate 的转换
c time_t 和 oc NSDate 的转换 1:time_t 转 oc NSDate time_t some_time_t=NULL; NSDate *someDate = [NSDate da ...
- FILETIME, SYSTEMTIME 与 time_t 相互转换
FILETIME, SYSTEMTIME 与 time_t 相互转换 2009-08-24 15:37:14| 分类: 默认分类|举报|字号 订阅 //******************* ...
- time_t转换为DateTime
最近解析文华财经的日线数据. 取得的第一个字段是日期,为time_t格式(long)的. 因为是用C#来写解析程序,所以要转换为DateTime的. time_t是世界时间,要转换为本地时间,所以要加 ...
- clock_t与time_t的区别及联系
clock_t <ctime> Clock type Type capable of representing clock tick counts and support arithmet ...
- time_t和struct tm之间的转换
time_t到struct tm的转换: #include <time.h> struct tm *localtime(const time_t *timep); struct tm到ti ...
- 【转】C/C++中的日期和时间 TIME_T与STRUCT TM转换——2013-08-25 16
http://www.cnblogs.com/Wiseman/archive/2005/10/24/260576.html 摘要: 本文从介绍基础概念入手,探讨了在C/C++中对日期和时间操作所用到的 ...
- C++中实现 time_t, tm 相互转换
time_t -> tm: localtime tm -> time_t: mktime time_t curTime; time(&curTime); dwCurTime = c ...
随机推荐
- ModelSim之tcl自动化仿真
摘要: ModelSim的tcl最大的优势就在于它可以让整个仿真自动运行,免除每次进行各种用户界面控制操作的麻烦.用tcl就可以自动完成建库.映射库到物理目录.编译源代码.启动仿真器.运行仿真等一系列 ...
- 【Android】7.8 MyDemos项目的结构和主界面相关代码
分类:C#.Android.VS2015: 创建日期:2016-02-17 一.简介 上一讲已经说过,系统升级为Win10后,重新创建了一个新的项目:MyDemos,并把前7章合并到了这个项目中,这次 ...
- What’s a service mesh? And why do I need one?
https://buoyant.io/2017/04/25/whats-a-service-mesh-and-why-do-i-need-one/ Update 2018-02-06: Since t ...
- SQLAlchemy的“缓存”问题导致的BUG
问题描述: 最近做项目,遇到一个问题,两个项目操作同一个数据库,其中A项目用的pymysql链接操作数据库,B项目用的sqlalchemy,当我请求B项目中的一个接口,会通知A项目操作数据库,然后返回 ...
- .Net 三层架构开发初步
写在前面的话:在课堂上只是听老师讲过三层架构,知道大概是什么意思,我的理解就是将本来混合着写在一起的代码按功能性的不同分别写在不同的项目中,然后上层项目调用下层项目提供的接口,这样可以使代码的层次更清 ...
- css3实现立方体效果
<!DOCTYPE html><html><head><meta charset="utf-8" /><title>&l ...
- 【转载】LeetCode 题目总结/分类
引自:http://www.douban.com/note/330562764/ 注:此分类仅供大概参考,没有精雕细琢.有不同意见欢迎评论~ 利用堆栈:http://oj.leetcode.com/p ...
- 在N个元素的数组中获取K个元素的所有组合问题
可以写循环,也可以用模块. 百度许久找到一个博客 http://blog.sina.com.cn/s/blog_4a0824490101f1kc.html 详细介绍了Algorithm::Combin ...
- C++中冒号和双冒号的用法
1.冒号(:)用法 (1)表示机构内位域的定义(即该变量占几个bit空间) typedef struct _XXX{ unsigned char a:4; unsigned char c; } ; X ...
- js 函数参数 arguments[0]
function box() { return arguments[0] + '|' + arguments[1]; } al ...