Skip to Content
For Enterprise
For Government
For Higher Ed
For Individuals
For Marketing
For Enterprise
For Government
For Higher Ed
For Individuals
For Marketing
Explore Skills
Cloud Computing
Microsoft Azure
Amazon Web Services (AWS)
Google Cloud
Cloud Migration
Cloud Deployment
Cloud Platforms
Data Engineering
Data Warehouse
SQL
Apache Spark
Microsoft SQL Server
MySQL
Kafka
Data Lake
Streaming & Messaging
NoSQL Databases
Relational Databases
Data Science
Pandas
R
MATLAB
SAS
D3
Power BI
Tableau
Statistics
Exploratory Data Analysis
Data Visualization
AI & ML
Generative AI
Machine Learning
Artificial Intelligence (AI)
Deep Learning
Reinforcement Learning
Natural Language Processing
TensorFlow
Scikit-Learn
Hyperparameter Tuning
MLOps
Programming Languages
Java
JavaScript
Spring
Python
Go
C#
C++
C
Swift
Rust
Functional Programming
Software Architecture
Object-Oriented
Distributed Systems
Domain-Driven Design
Architectural Patterns
IT/Ops
Kubernetes
Docker
GitHub
Terraform
Continuous Delivery
Continuous Integration
Database Administration
Computer Networking
Operating Systems
IT Certifications
Security
Network Security
Application Security
Incident Response
Zero Trust Model
Disaster Recovery
Penetration Testing / Ethical Hacking
Governance
Malware
Security Architecture
Security Engineering
Security Certifications
Design
Web Design
Graphic Design
Interaction Design
Film & Video
User Experience (UX)
Design Process
Design Tools
Business
Agile
Project Management
Product Management
Marketing
Human Resources
Finance
Team Management
Business Strategy
Digital Transformation
Organizational Leadership
Soft Skills
Professional Communication
Emotional Intelligence
Presentation Skills
Innovation
Critical Thinking
Public Speaking
Collaboration
Personal Productivity
Confidence / Motivation
Features
All features
Verifiable skills
AI Academy
Courses
Certifications
Interactive learning
Live events
Superstreams
Answers
Insights reporting
Radar Blog
Buy Courses
Plans
Sign In
Try Now
O'Reilly Platform
book
LINUX系統程式設計 第二版
by
Robert Love
December 2013
Intermediate to advanced
496 pages
8h 57m
Chinese
GoTop Information, Inc.
Content preview from
LINUX系統程式設計 第二版
392
|
第十一章
時間的資料結構
在
Unix
系統發展的同時,為時間管理實現了它們自己的介面,有多種資料結構用來表
示看似簡單的時間概念。這些資料結構包括簡單的整數以及各種多欄位的結構。探討實
際的介面之前,讓我們先來瞭解這些資料結構。
原始的表示法
time_t
(定義於標頭檔
<time.h>
)是其中最簡單的資料結構。
time_t
是一個不透明的型
別(
opaque type
)。然而,在多數
Unix
系統上,包括
Linux
,此型別只是
C
語言之
long
型別的
typedef
:
typedef long time_t;
time_t
代表自紀元後已過去的秒數。典型的反應是『發生溢位之前,它就會被廢棄不
用!』事實上,它的壽命可能會比你所預期的還久,儘管有大量的
Unix
系統仍在使用
它,但是它的確將溢位。由於是一個
32-bit
的
long
型別,
time_t
至多可以表示自紀元後
過去了
2,147,483,647
秒。這意味我們將於
2038
年再度遭遇
Y2K
的窘境!然而,幸運
的是,等到
2038-01-18 22:14:07
來臨時,多數的系統與軟體將會使用
64-bit
的時間值。
然而現在是:微秒的精確度
與
time_t
有關的另一個議題是,一秒之內會發生許多次。
timeval
結構用於擴充
time_t
,
加入了微秒的精確度。此結構,定義於標頭檔
<sys/time.h>
,如下所示:
#include <sys/time.h>
struct timeval {
time_t tv_sec; /* seconds ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial
You might also like
優雅的SciPy|Python科學研究的美學
Juan Nunez-Iglesias, Stéfan van der Walt, Harriet Dashnow
成為卓越程式設計師的38項必修法則
Pete Goodliffe
深入理解運算原理|從簡單的機器到無所不能的程式
Tom Stuart
C++语言导学(原书第2版)
本贾尼 斯特劳斯特鲁普
Publisher Resources
ISBN: 9789862769812