Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the time () function in linux

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to use the time () function in linux. It is very detailed and has a certain reference value. Friends who are interested must finish it!

The time () function gets the current time

1 SYNOPSIS 2 # include 3 4 time_t time (time_t * t); 5 6 DESCRIPTION 7 time () returns the time as the number of seconds since the Epoch, 1970-01-01 00:00:00 + 0000 (UTC). 8 / / this function returns the number of seconds that have elapsed since 00:00:00 of UTC time on January 1, 1970. If t is not a null pointer, this function also stores the return value to the memory referred to by the t pointer. 9 RETURN VALUE 10 On success, the value of time in seconds since the Epoch is returned. On error, (time_t)-1) is returned, and errno is 11 set appropriately. 12 ERRORS 13 EFAULT t points outside your accessible address space. 14 / / the number of seconds returned for success, and the error returns (time_t)-1). The cause of the error is stored in errno eg:

1 # include 2 # include 3 # include 4 5 int main () 6 {7 time_t seconds; 8 9 seconds = time ((time_t *) NULL); 10 printf ("% d\ n", seconds); 11 12 return 0; 13} these are all the contents of the article "how to use the time () function in linux". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report