当前位置:网站首页>12. Gettimeofday() and time()
12. Gettimeofday() and time()
2022-07-04 01:59:00 【666QAQ】
- gettimeofday()
gettimeofday()Can be found intvThe buffer pointed to is returned from Epoch(UTC 1970.1.1 00:00:00) Seconds since , Date stored intime_tVariable of type , This is a SUSv3 Defined integer type )
#include <sys/time.h>
int gettimeofday(struct timeval *tv, struct timezone*tz);
Returns 0 on success, or -1 on error
Parameters tv Is a pointer to the following data structure :
struct timeval{
time_t tv_sec; /*Seconds since 00:00:00, 1 Jan 1970 UTC*/
suseconds_t tv_sec; /*Addtional microseconds (long int)*/
}
Parameters tz Has been abandoned , Pass in on use NULL that will do .
2.time()time() The function also returns from Epoch Seconds since , This is due to historical reasons ,gettimeofday() More accurate , later time() It is right gettimeofday() Call to .
#include <time.h>
time_t time(time_t *timep);
Returns number of seconds since the Epoch or (time_t)-1 on error
time() Return the number of seconds in two ways , Parameters timep Or return value , But to avoid mistakes , Usually simply call :
time_t t = time(NULL);
Reference material :《Linuc/UNIX System programming manual 》
边栏推荐
- Containerization technology stack
- Push technology practice | master these two tuning skills to speed up tidb performance a thousand times!
- How programmers find girlfriends through blind dates
- Special copy UML notes
- 2020-12-02 SSM advanced integration Shang Silicon Valley
- Small program graduation project based on wechat e-book small program graduation project opening report function reference
- On Valentine's day, I code a programmer's exclusive Bing Dwen Dwen (including the source code for free)
- Example 072 calculation of salary it is known that the base salary of an employee of a company is 500 yuan. The amount of software sold by the employee and the Commission method are as follows: Sales
- Difference between value and placeholder
- What is the intelligent monitoring system of sewage lifting pump station and does it play a big role
猜你喜欢
![[leetcode daily question] a single element in an ordered array](/img/3a/2b465589b70cd6aeec08e79fcf40d4.jpg)
[leetcode daily question] a single element in an ordered array

C import Xls data method summary II (save the uploaded file to the DataTable instance object)

MySQL advanced SQL statement (1)

Huawei cloud micro certification Huawei cloud computing service practice has been stable

Override and virtual of classes in C #

Conditional test, if, case conditional test statements of shell script

Maximum likelihood method, likelihood function and log likelihood function

MySQL statement learning record

Chapter 3.4: starrocks data import - Flink connector and CDC second level data synchronization

Infiltration learning diary day19
随机推荐
Remember another interview trip to Ali, which ends on three sides
Writeup (real questions and analysis of ciscn over the years) of the preliminary competition of national college students' information security competition
Jerry's synchronous weather information to equipment [chapter]
Intel's new GPU patent shows that its graphics card products will use MCM Packaging Technology
Neo4j learning notes
From the 18th line to the first line, the new story of the network security industry
How programmers find girlfriends through blind dates
1189. Maximum number of "balloons"
Yyds dry goods inventory override and virtual of classes in C
Jerry's update contact [article]
mysql使用視圖報錯,EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
51 MCU external interrupt
Pytoch residual network RESNET
Hamburg University of Technology (tuhh) | intelligent problem solving as integrated hierarchical reinforcement learning
How to subcontract uniapp and applet, detailed steps (illustration) # yyds dry goods inventory #
Portable two-way radio equipment - current market situation and future development trend
JVM performance tuning and practical basic theory - medium
Pyrethroid pesticide intermediates - market status and future development trend
IPv6 experiment
Development of user-defined navigation bar in uniapp