请教time_t结构是怎么定义的?

djsaflkdsj 2004-12-09 09:13:00
请教time_t结构是怎么定义的?它里面都有什么数据成员呀?谢谢
...全文
9038 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
sure11669 2010-06-20
  • 打赏
  • 举报
回复
typedef long time_t
FallenAngel 2004-12-13
  • 打赏
  • 举报
回复
time_t now ;
char strTime[9] = {0} ;
time(&now) ;
strftime(strTime, sizeof(strTime), "%Y%m%d", localtime(&now)) ;
puts(strTime) ;
pacman2000 2004-12-10
  • 打赏
  • 举报
回复
是unsigned long吧。
sharkhuang 2004-12-10
  • 打赏
  • 举报
回复
unsigned long
bruceteen 2004-12-10
  • 打赏
  • 举报
回复
time_t 就是 long,其存储格林威治标准时间1970年1月1日0时0分0秒到所表示时间的间隔秒数。
比如
time_t(0) 表示 格林威治标准时间1970年1月1日0时0分0秒
time_t(2) 表示 格林威治标准时间1970年1月1日0时0分2秒
djsaflkdsj 2004-12-10
  • 打赏
  • 举报
回复
请问怎么把time_t 转换成时间呀?不是问用什么函数,而是问time_t 里面的值是什么意思?谢谢
Squall1009 2004-12-09
  • 打赏
  • 举报
回复
是啊 , 就是一个long的变量啊
winstonch 2004-12-09
  • 打赏
  • 举报
回复
time_t long integer
piaozi2003 2004-12-09
  • 打赏
  • 举报
回复
time_t long integer

struct tm 结构 ----

tm_hour Hours since midnight (0–23)
tm_isdst Positive if daylight saving time is in effect;
tm_mday Day of month (1–31)
tm_min Minutes after hour (0–59)
tm_mon Month (0–11; January = 0)
tm_sec Seconds after minute (0–59)
tm_wday Day of week (0–6; Sunday = 0)
tm_yday Day of year (0–365; January 1 = 0)
tm_year Year (current year minus 1900)
realee 2004-12-09
  • 打赏
  • 举报
回复
是长整型呀,返回seconds since UTC 70/1/1 00:00:00
FallenAngel 2004-12-09
  • 打赏
  • 举报
回复
time_t不是结构,它是double型的变量吧
tm倒是结构

69,373

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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