Botan
1.11.15
|
00001 /* 00002 * Calendar Functions 00003 * (C) 1999-2009 Jack Lloyd 00004 * 00005 * Botan is released under the Simplified BSD License (see license.txt) 00006 */ 00007 00008 #ifndef BOTAN_CALENDAR_H__ 00009 #define BOTAN_CALENDAR_H__ 00010 00011 #include <botan/types.h> 00012 #include <chrono> 00013 00014 namespace Botan { 00015 00016 /** 00017 * Struct representing a particular date and time 00018 */ 00019 struct BOTAN_DLL calendar_point 00020 { 00021 /** The year */ 00022 u32bit year; 00023 00024 /** The month, 1 through 12 for Jan to Dec */ 00025 byte month; 00026 00027 /** The day of the month, 1 through 31 (or 28 or 30 based on month */ 00028 byte day; 00029 00030 /** Hour in 24-hour form, 0 to 23 */ 00031 byte hour; 00032 00033 /** Minutes in the hour, 0 to 60 */ 00034 byte minutes; 00035 00036 /** Seconds in the minute, 0 to 60, but might be slightly 00037 larger to deal with leap seconds on some systems 00038 */ 00039 byte seconds; 00040 00041 /** 00042 * Initialize a calendar_point 00043 * @param y the year 00044 * @param mon the month 00045 * @param d the day 00046 * @param h the hour 00047 * @param min the minute 00048 * @param sec the second 00049 */ 00050 calendar_point(u32bit y, byte mon, byte d, byte h, byte min, byte sec) : 00051 year(y), month(mon), day(d), hour(h), minutes(min), seconds(sec) {} 00052 }; 00053 00054 /* 00055 * @param time_point a time point from the system clock 00056 * @return calendar_point object representing this time point 00057 */ 00058 BOTAN_DLL calendar_point calendar_value( 00059 const std::chrono::system_clock::time_point& time_point); 00060 00061 } 00062 00063 #endif