Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use the mktime () function in linux

Shulou Source: shulou.com Published: 2022-06-01 03:00:52 09月17日 Update

This article mainly shows you "how to use the mktime () function in linux", which is easy to understand and clear. I hope it can help you solve your doubts. Let me lead you to study and learn how to use the mktime () function in linux.

Mktime () converts the value of the time structure struct tm to the number of seconds elapsed

Function prototype:

1 # include 2 3 time_t mktime (struct tm * tm); 4 5 / * * convert the value of the time structure struct tm into the number of seconds elapsed * * / eg:

1 # include 2 # include 3 # include 4 5 int main () 6 {7 time_t timep; 8 struct tm * p; 9 10 time (& timep); 11 p = localtime (& timep); 12 timep = mktime (p); 13 14 printf ("% d\ n", timep); 15 16 return 0 17} these are all the contents of the article "how to use the mktime () function in linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Function content article time structure learning help prototype easy to understand more organization knowledge editing industry information information channel channel research Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Apple Redmi MySQL vpn