MentOS  0.8.0
The Mentoring Operating System
time.h
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include "stddef.h"
9 
12 #define ITIMER_REAL 0
15 #define ITIMER_VIRTUAL 1
19 #define ITIMER_PROF 2
20 
22 typedef unsigned int time_t;
23 
25 typedef struct tm {
27  int tm_sec;
29  int tm_min;
31  int tm_hour;
33  int tm_mday;
35  int tm_mon;
37  int tm_year;
39  int tm_wday;
41  int tm_yday;
43  int tm_isdst;
44 } tm_t;
45 
47 typedef struct timeval {
51 
53 typedef struct itimerval {
54  struct timeval it_interval;
55  struct timeval it_value;
57 
59 typedef struct timespec {
61  long tv_nsec;
63 
68 
73 time_t difftime(time_t time1, time_t time2);
74 
78 tm_t *localtime(const time_t *timep);
79 
87 size_t strftime(char *s, size_t max, const char *format, const tm_t *tm);
88 
100 int nanosleep(const struct timespec *req, struct timespec *rem);
101 
108 unsigned int sleep(unsigned int seconds);
109 
115 int getitimer(int which, struct itimerval *curr_value);
116 
124 int setitimer(int which, const struct itimerval *new_value, struct itimerval *old_value);
#define max(a, b)
The max of the two values.
Definition: math.h:12
Define basic data types.
Rappresents a time interval.
Definition: time.h:53
struct timeval it_value
Current value.
Definition: time.h:55
struct timeval it_interval
Next value.
Definition: time.h:54
Specify intervals of time with nanosecond precision.
Definition: time.h:59
long tv_nsec
Nanoseconds.
Definition: time.h:61
time_t tv_sec
Seconds.
Definition: time.h:60
Rappresents time.
Definition: time.h:47
time_t tv_usec
Microseconds.
Definition: time.h:49
time_t tv_sec
Seconds.
Definition: time.h:48
Used to get information about the current time.
Definition: time.h:25
int tm_mon
Month [0 to 11].
Definition: time.h:35
int tm_year
Year [since 1900].
Definition: time.h:37
int tm_hour
Hours [0 to 23].
Definition: time.h:31
int tm_sec
Seconds [0 to 59].
Definition: time.h:27
int tm_isdst
Is Daylight Saving Time.
Definition: time.h:43
int tm_yday
Day in the year [0 to 365].
Definition: time.h:41
int tm_mday
Day of the month [1 to 31].
Definition: time.h:33
int tm_min
Minutes [0 to 59].
Definition: time.h:29
int tm_wday
Day of the week [0 to 6].
Definition: time.h:39
int nanosleep(const struct timespec *req, struct timespec *rem)
Suspends the execution of the calling thread.
int setitimer(int which, const struct itimerval *new_value, struct itimerval *old_value)
The system provides each process with three interval timers, each decrementing in a distinct time dom...
struct tm tm_t
Used to get information about the current time.
unsigned int time_t
Used to store time values.
Definition: time.h:22
size_t strftime(char *s, size_t max, const char *format, const tm_t *tm)
Formats the time tm according to the format specification format and places the result in the charact...
Definition: time.c:94
time_t difftime(time_t time1, time_t time2)
Return the difference between the two time values.
Definition: time.c:51
unsigned int sleep(unsigned int seconds)
Causes the calling thread to sleep either until the number of real-time seconds specified in seconds ...
struct itimerval itimerval_t
Rappresents a time interval.
struct timespec timespec_t
Specify intervals of time with nanosecond precision.
tm_t * localtime(const time_t *timep)
The current time broken down into a tm_t structure.
Definition: time.c:79
time_t time(time_t *t)
Returns the current time.
struct timeval timeval_t
Rappresents time.
int getitimer(int which, struct itimerval *curr_value)
Fills the structure pointed to by curr_value with the current setting for the timer specified by whic...