stdlibc/time: +calculation of weekday and yearday
[meinos.git] / apps / include / time.h
blobdb49dbfd1f1ce6f723c78844c8aad1f9ea1174cf
1 /*
2 meinOS - A unix-like x86 microkernel operating system
3 Copyright (C) 2008 Janosch Gräf <janosch.graef@gmx.net>
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef _TIME_H_
20 #define _TIME_H_
22 #include <sys/types.h>
24 #define CLOCKS_PER_SEC 100 /// @see kernel2/cpu.h
25 #define CLOCK_REALTIME 0 // ID of Realtime clock (?) ///< @see ?
26 #define TIMER_ABSTIME 0 // Flag indicating time is absolute ///< @see ?
27 #define CLOCK_MONOTONIC 1 // ID of monotonic clock (?) ///< @see ?
29 struct tm {
30 int tm_sec; // Seconds [0..59]
31 int tm_min; // Minute [0..59]
32 int tm_hour; // Hour [0..23]
33 int tm_mday; // Day of month [1..31]
34 int tm_mon; // Month of year [0..11]
35 int tm_year; // Years since 1900
36 int tm_wday; // Day of Week [0..6] (Sunday=0)
37 int tm_yday; // Day of Year [0..365]
38 int tm_isdst; // Daylight Savings Flag
40 struct timespec {
41 time_t tv_sec;
42 long tv_nsec;
44 struct itimerspec {
45 struct timespec it_interval; // Timer period.
46 struct timespec it_value; // Timer expiration.
49 time_t time(time_t *tloc);
50 time_t mktime(struct tm *tm);
51 char *asctime(const struct tm *timeptr);
52 clock_t clock();
54 #endif