In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how to get time in Linux system. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
There are two kinds of Linux system times.
(1) calendar time. This value is the cumulative number of seconds that have elapsed since 00:00:00 coordinated Universal time (UTC) on January 1, 1970. Basic data types are saved in time_t. Finally, through the conversion, we can get the 24-hour system or 12-hour interval time we usually see.
(2) process time. Also known as CPU time, it measures the CPU resources used by the process. The process time is calculated by clock tick.
This article will give you a detailed introduction to the acquisition and use of Linux time. Let's take a look at the detailed introduction.
Get timestamp
Time ()
# include time_t time (time_t * calptr)
Time returns the timestamp of the current time, that is, the number of seconds from UTC to the present
Time_t is actually a uint64_t.
When calptr is not empty, the timestamp is also written to the pointer
Call example:
# include # include # include using namespace std;int main () {time_t curTime;curTime = time (NULL); cout
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: 288
*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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.