当前位置:网站首页>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
边栏推荐
- Leetcode40 - total number of combinations II
- What is a dial-up server and what is its use?
- 单片机和4G模块通信总结(EC20)
- 2022.4.20-----leetcode.388
- 今天终于会写System.out.println()了
- 浅析一下隧道代理IP的优缺点。
- 搭建网站是用物理机还是云主机好?
- A simple and open source navigation website source code
- Realize linear regression with tensorflow (including problems and solutions in the process)
- Esp32 message queue using FreeRTOS
猜你喜欢

搭建网站是用物理机还是云主机好?

Some tips for using proxy IP.
![leetcode:27. Remove element [count remove]](/img/af/e5cd9ef8dc43aab4ddf016600ffc4a.png)
leetcode:27. Remove element [count remove]

Challenges often faced by client project management

007_Redis_Jedis连接池

Introduction to micro build low code zero Foundation (lesson 2)

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

Dynamic batch processing and static batch processing of unity

FL studio20. 8 the latest Chinese version installation and download graphic tutorial

What categories do you need to know before using proxy IP?
随机推荐
postman里面使用 xdebug 断点调试
leetcode:27. 移除元素【count remove小操作】
RuntimeError: The size of tensor a (4) must match the size of tensor b (3) at non-singleton dimensio
Quel est le fichier makefile?
2022.4.10-----leetcode. eight hundred and four
【动手学深度学习V2】循环神经网络-1.序列模型
How to classify proxy IP?
Micro build low code zero foundation introductory course
89 logistic回归用户画像用户响应度预测
Is CICC fortune a state-owned enterprise and is it safe to open an account
简洁开源的一款导航网站源码
007_Redis_Jedis连接池
keil mdk中文乱码,两种解决方法,字体不再难看
Introduction to micro build low code zero Foundation (lesson 2)
011_RedisTemplate操作Hash
006_redis_jedis快速入门
How to call out services in idea and display the startup class in services
什么是代理IP池,如何构建?
一加一为什么等于二
世界读书日 | 技术人不要错过的好书(IT前沿技术)