20 #include "pedigree/kernel/processor/types.h" 21 #include "pedigree/kernel/time/Time.h" 22 #include "pedigree/kernel/utilities/assert.h" 24 static const uint16_t cumulativeDays[] = {0, 31, 59, 90, 120, 151, 181,
25 212, 243, 273, 304, 334, 365};
32 size_t second,
size_t minute,
size_t hour,
size_t dom,
size_t month,
36 assert(month >= 1 && month <= 12);
37 assert(dom >= 1 && dom <= 31);
42 size_t leaps = (year / 4) - (year / 100) + (year / 400);
44 leaps -= (1970 / 4) - (1970 / 100) + (1970 / 400);
46 size_t cumuldays = cumulativeDays[month - 1];
48 Time::Timestamp result = 0;
50 result += minute * 60;
51 result += hour * 60 * 60;
52 result += dom * 24 * 60 * 60;
53 result += cumuldays * 24 * 60 * 60;
54 result += leaps * 24 * 60 * 60;
55 result += (year - 1970) * 365 * 24 * 60 * 60;