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 ...
随机推荐
- android发送短信样例
Android应用开发中我们经常须要发送手机短信.这对于android平台来说,是最简单只是的功能了,无需太多代码,也无需自己定义代码,仅仅须要调用android提供的消息管理类SmsManager就 ...
- vim环境配置
ctags ctags对浏览代码非常的方便,可以在函数.变量之间跳来跳去等等. 下载 下载路径:http://ctags.sourceforge.net/ 我已经下载过了,路径:/home1/fuju ...
- 对JAVASCRIPT匿名函数的理解
网上很多解释,我无法理解,我想知道原理...这篇文章应该可以透彻一点 Query片段: (function(){ //这里忽略jQuery所有实现 })(); 要说匿名函数,我们首先要由函数本身说起. ...
- mysql linux 区分大小写
查看大小写区分 mysql> show variables like "%case%"; +------------------------+-------+ | Varia ...
- 多进程监控自动关机工具升级远程关闭多台server——C# works with PowerShell
之前给单位做过一个多进程监控的自动关机工具,详见那篇blog. 这次领导又加了需求,说要等进程监控结束后,不止需要关闭主控端server,还需要关闭其他servers.于是就用到了我上篇文章所介绍的知 ...
- 实战入侵(突破FCK+安全狗上传)
PS:有点尴尬,二次上传突破FCK,免杀马儿过狗. 刚开始和超霸一起弄,TMDGB.弄到四点多,早上尼玛七点多的又去考试,虽然考试还是睡着了,但是TMDGB感觉日子好充实啊! FCK上传地址如下所示: ...
- 如何设置电脑的固定IP地址
大家在上网时电脑的IP地址往往都是自动选择的,但在局域网内有时会方便共享文件和监控流量等操作时需要固定的IP地址.下面将简单介绍如何手设置电脑的固定IP地址. 百度经验:jingyan.baidu.c ...
- 【Visual Studio】解决方案未保存,请先保存你的解决方案,然后再管理Nuget包
上网下的Demo,文件夹中没有.sln文件,用VS打开.csproj文件来打开方案.此时可能因为一些引用问题想打开Nuget包管理器,会弹出如下提示: 解决方案未保存,请先保存你的解决方案,然后再管理 ...
- ExtJs GridPanel 给表格行或者单元格自定义样式
Ext.onReady(function(){ Ext.create('Ext.data.Store', { storeId:'simpsonsStore', fields:['name', 'ema ...
- linux中mysql表名默认区分大小写导致表找不到的问题
天将window的项目迁移到linux上面,然后登录时一直报用户表找不到的错误信息. 检查发现数据库中的表名是m_user, 后来才想起来是大小写问题, 找到问题原因,解决方案如下: 修改/etc/m ...