当前位置:网站首页>C standard library - < time h>
C standard library - < time h>
2022-04-23 02:04:00 【Huang Jiajun】
brief introduction
time.h The header file defines four variable types 、 Two macros and various functions of operation date and time .
Library variables
Here's the header file time.h Variable types defined in :
| Serial number | Variable & describe |
|---|---|
| 1 | size_t Is an unsigned integer type , It is sizeof Keyword results . |
| 2 | clock_t This is a type suitable for storage processor time . |
| 3 | time_t is This is a type suitable for storing calendar time . |
| 4 | struct tm This is a structure for saving time and date . |
tm The definition of structure is as follows :
struct tm {
int tm_sec; /* second , Range from 0 To 59 */
int tm_min; /* branch , Range from 0 To 59 */
int tm_hour; /* Hours , Range from 0 To 23 */
int tm_mday; /* The day of the month , Range from 1 To 31 */
int tm_mon; /* month , Range from 0 To 11 */
int tm_year; /* since 1900 The number of years since */
int tm_wday; /* The day of the week , Range from 0 To 6 */
int tm_yday; /* The day of the year , Range from 0 To 365 */
int tm_isdst; /* Daylight saving time */
};
Library macro
Here's the header file time.h Macro defined in :
| Serial number | macro & describe |
|---|---|
| 1 | NULL This macro is the value of a null pointer constant . |
| 2 | CLOCKS_PER_SEC This macro represents the number of processor clocks per second . |
Library function
Here's the header file time.h The function defined in :
| Serial number | function & describe |
|---|---|
| 1 | char *asctime(const struct tm *timeptr) Returns a pointer to a string , It represents the structure timeptr The date and time of . |
| 2 | clock_t clock(void) Return to the beginning of program execution ( It's usually the beginning of a program ), The time used by the processor clock . |
| 3 | char *ctime(const time_t *timer) Returns a string representing the local time , Local time is based on parameters timer. |
| 4 | double difftime(time_t time1, time_t time2) return time1 and time2 The number of seconds between (time1-time2). |
| 5 | struct tm *gmtime(const time_t *timer) timer The value of is decomposed into tm structure , And use coordinated universal time (UTC) Also known as Greenwich mean time (GMT) Express . |
| 6 | struct tm *localtime(const time_t *timer) timer The value of is decomposed into tm structure , And expressed in local time zone . |
| 7 | time_t mktime(struct tm *timeptr) hold timeptr The structure pointed to is converted to a structure based on the local time zone time_t value . |
| 8 | size_t strftime(char *str, size_t maxsize, const char *format, const struct tm *timeptr) according to format Formatting rules defined in , Format structure timeptr Time represented , And store it in str in . |
| 9 | time_t time(time_t *timer) Calculate the current calendar time , And code it into time_t Format . |
版权声明
本文为[Huang Jiajun]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220842089600.html
边栏推荐
- How to call out services in idea and display the startup class in services
- Use of j-link RTT
- Is CICC fortune a state-owned enterprise and is it safe to open an account
- 简洁开源的一款导航网站源码
- Realize linear regression with tensorflow (including problems and solutions in the process)
- [Dahua cloud native] micro service chapter - service mode of five-star hotels
- easyswoole环境配置
- Dynamic memory management
- 007_Redis_Jedis连接池
- 假如404页面是这样的 | 每日趣闻
猜你喜欢

World Book Day 𞓜 a good book that technicians should not miss (it cutting-edge technology)

Analyze the three functions of static proxy IP.

【汇编语言】从最底层的角度理解“堆栈”

如何“优雅”的测量系统性能

拨号vps会遇到什么问题?

Is the availability of proxy IP equal to the efficiency of proxy IP?

007_Redis_Jedis连接池

What is a proxy IP pool and how to build it?

Uncover floating-point operations hidden by the ARM compiler

What businesses use physical servers?
随机推荐
2018 China Collegiate Programming Contest - Guilin Site J. stone game
今天终于会写System.out.println()了
什么是代理IP池,如何构建?
How to write the resume of Software Test Engineer so that HR can see it?
【dpdk】10. Dpdk DNS learning notes
NPM yarn startup error [resolved]
关于局域网浅谈
Thinkphp内核开发盲盒商城源码v2.0 对接易支付/阿里云短信/七牛云存储
013_基于Session实现短信验证码登录流程分析
2022.4.22-----leetcode. three hundred and ninety-six
Makefile文件是什么?
Makefile文件是什麼?
Nanny level tutorial on building personal home page (II)
Some tips for using proxy IP.
How can e-procurement become a value-added function in the supply chain?
Is the sinking coffee industry a false prosperity or the eve of a broken situation?
[tutorial] how to use GCC "zero assembly" for white whoring MDK
006_redis_jedis快速入门
Error in face detection and signature of Tencent cloud interface
[leetcode daily question] 396 Rotation function