#include <sys/timespec.h>
Go to the source code of this file.
◆ tm
Definition at line 7 of file time.h.
Data Fields |
int |
tm_hour |
|
int |
tm_isdst |
|
int |
tm_mday |
|
int |
tm_min |
|
int |
tm_mon |
|
int |
tm_sec |
|
int |
tm_wday |
|
int |
tm_yday |
|
int |
tm_year |
|
◆ asctime()
char * asctime |
( |
const struct tm * |
tm | ) |
|
Definition at line 64 of file time.c.
65{
68}
char * asctime_r(const struct tm *tm, char *buf)
◆ asctime_r()
char * asctime_r |
( |
const struct tm * |
tm, |
|
|
char * |
buf |
|
) |
| |
Definition at line 50 of file time.c.
51{
52
53
54
59
61}
static const char * months[12]
static const char * dayOfWeek[7]
int snprintf(char *str, size_t size, const char *fmt,...) __printflike(3
◆ ctime()
char * ctime |
( |
const time_t * |
timep | ) |
|
Definition at line 78 of file time.c.
79{
81}
struct tm * localtime(const time_t *timep)
char * asctime(const struct tm *tm)
◆ ctime_r()
char * ctime_r |
( |
const time_t * |
timep, |
|
|
char * |
buf |
|
) |
| |
Definition at line 71 of file time.c.
72{
75}
struct tm * localtime_r(const time_t *timep, struct tm *result)
◆ gmtime()
struct tm * gmtime |
( |
const time_t * |
timep | ) |
|
Definition at line 164 of file time.c.
165{
168}
struct tm * gmtime_r(const time_t *timep, struct tm *tm)
◆ gmtime_r()
struct tm * gmtime_r |
( |
const time_t * |
timep, |
|
|
struct tm * |
result |
|
) |
| |
Definition at line 108 of file time.c.
109{
113
114
115 secs = *timep % (60 * 60 * 24);
116 days = *timep / (60 * 60 * 24);
117 mins = secs / 60;
118 secs = secs % 60;
119
120
121 hours = mins / 60;
122 mins = mins % 60;
123
124
125 hours = hours % 24;
126
130
132
133 for (y = 1970; ; y++) {
136 daysOfYear = 366;
137 } else {
138 daysOfYear = 365;
139 }
140
141 if (days < daysOfYear) {
144 break;
145 }
146 days -= daysOfYear;
147 }
148
149 for (m = 0; ; m++) {
151
152 if (days < daysOfMonth) {
155 break;
156 }
157 days -= daysOfMonth;
158 }
159
161}
static int Time_DaysInMonth(uint64_t year, uint64_t month)
static bool Time_IsLeapYear(uint64_t year)
◆ localtime()
struct tm * localtime |
( |
const time_t * |
timep | ) |
|
◆ localtime_r()
struct tm * localtime_r |
( |
const time_t * |
timep, |
|
|
struct tm * |
result |
|
) |
| |
◆ mktime()
Definition at line 185 of file time.c.
186{
190
191
194 days += 366;
195 else
196 days += 365;
197 }
198
202 }
204 days += yday;
205
209
211
212 return secs;
213}
◆ time()
Definition at line 20 of file time.c.
21{
23 time_t sec = nsec / 1000000000;
24
25 if (t)
26 *t = sec;
27
28 return sec;
29}