当前位置:网站首页>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 》
边栏推荐
- Solution of cursor thickening
- Small program graduation project based on wechat reservation small program graduation project opening report reference
- MySQL advanced (Advanced) SQL statement (I)
- All metal crowns - current market situation and future development trend
- Basic editing specifications and variables of shell script
- Introduction to graphics: graphic painting (I)
- Lightweight Pyramid Networks for Image Deraining
- Software product download collection
- Chapter 3.4: starrocks data import - Flink connector and CDC second level data synchronization
- Example 073 square sum value judgment programming requires the input of a and B, if a ²+ b ² If the result of is greater than 100, a is output ²+ b ² Value, otherwise output the result of a + B.
猜你喜欢

Huawei rip and BFD linkage

Lightweight Pyramid Networks for Image Deraining
![Jerry's watch listens to the message notification of the target third-party software and pushes the message to the device [article]](/img/8b/ff062f34d36e1caa9909c8ab431daf.jpg)
Jerry's watch listens to the message notification of the target third-party software and pushes the message to the device [article]

Pytoch residual network RESNET

String hash, find the string hash value after deleting any character, double hash

When tidb meets Flink: tidb efficiently enters the lake "new play" | tilaker team interview

MySQL introduction - functions (various function statistics, exercises, details, tables)

SRCNN:Learning a Deep Convolutional Network for Image Super-Resolution

Remember a lazy query error

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
随机推荐
Huawei cloud micro certification Huawei cloud computing service practice has been stable
MySQL advanced (Advanced) SQL statement (I)
Description of setting items of Jerry [chapter]
Development of user-defined navigation bar in uniapp
Hamburg University of Technology (tuhh) | intelligent problem solving as integrated hierarchical reinforcement learning
[typora installation package] old typera installation package, free version
Is Shengang securities company as safe as other securities companies
Meta metauniverse female safety problems occur frequently. How to solve the related problems in the metauniverse?
Some other configurations on Huawei's spanning tree
Write the first CUDA program
Day05 branch and loop (II)
C import Xls data method summary V (complete code)
MySQL advanced SQL statement (1)
JVM performance tuning and practical basic theory - medium
2022 electrician (elementary) examination question bank and electrician (elementary) simulation examination question bank
Prose article appreciation - the rain in the warm country has never changed into cold, hard and brilliant flowers. Knowledgeable people think he is monotonous, and he thinks he is unlucky, doesn't he?
Lightweight Pyramid Networks for Image Deraining
Software product download collection
1189. Maximum number of "balloons"
All ceramic crowns - current market situation and future development trend