00001 /* 00002 * PROPRIETARY INFORMATION. This software is proprietary to 00003 * Side Effects Software Inc., and is not to be reproduced, 00004 * transmitted, or disclosed in any way without written permission. 00005 * 00006 * Produced by: 00007 * Mark Elendt 00008 * Side Effects Software Inc 00009 * 477 Richmond Street West 00010 * Toronto, Ontario 00011 * Canada M5V 3E7 00012 * 416-504-9876 00013 * 00014 * NAME: UT_Date.h ( UT Library, C++) 00015 * 00016 * COMMENTS: Time/Date handling 00017 */ 00018 00019 #ifndef __UT_Date__ 00020 #define __UT_Date__ 00021 00022 #include "UT_API.h" 00023 #include <sys/types.h> 00024 #include <time.h> 00025 #include <iostream.h> 00026 00027 class UT_API UT_Date { 00028 public: 00029 // Print the time given a format like the UNIX date command 00030 // a locale's abbreviated weekday name 00031 // A locale's full weekday name 00032 // b locale's abbreviated month name 00033 // B locale's full month name 00034 // c locale's appropriate date and time representation 00035 // C century (a year divided by 100 and truncated to an integer) as a 00036 // decimal number [00-99] 00037 // d day of month as a decimal number [01-31] 00038 // D date as %m/%d/%y 00039 // e day of month as a decimal number [1-31] (single digits are 00040 // preceded by a blank) 00041 // h locale's abbreviated month name (alias for %b) 00042 // H hour (24-hour clock) as a decimal number [00-23] 00043 // I hour (12-hour clock) as a decimal number [01-12] 00044 // j day of year as a decimal number [001-366] 00045 // m month of year as a decimal number [01-12] 00046 // M minute as a decimal number [00-59] 00047 // n insert a newline character 00048 // p string containing ante-meridian or post-meridian indicator (by 00049 // default, AM or PM) 00050 // r 12-hour clock time [01-12] using the AM/PM notation, as %I:%M:%S 00051 // %p 00052 // R time as %H:%M 00053 // S seconds as a decimal number [00-61], allows for leap seconds 00054 // t insert a tab character 00055 // T 24-hour clock time [00-23], as %H:%M:%S 00056 // u weekday as a decimal number [1(Monday)-7] 00057 // U* week number of year (Sunday as the first day of the week) as a 00058 // decimal number [00-53]. All days in a new year preceding the 00059 // first Sunday are considered to be in week 0. 00060 // V* week of the year (Monday as the first day of the week) as a 00061 // decimal number [01-53]. If the week containing January 1 has four 00062 // or more days in the new year, then it is considered week 1; 00063 // otherwise, it is week 53 of the previous year, and the next week 00064 // is week 1. ( See the ISO 8601:1988 standard) 00065 // w weekday as a decimal number [0(Sunday)-6] 00066 // W* week of year (Monday as the first day of the week) as a decimal 00067 // number [00-53]. All days in a new year preceding the first 00068 // Sunday are considered to be in week 0. 00069 // x locale's appropriate date representation 00070 // X locale's appropriate time representation 00071 // y year within century (offset from %C) as a decimal number [00-99] 00072 // Y year as ccyy (4 digits) 00073 // Z timezone name, or no characters if no timezone is determinable 00074 // % insert a percent sign character 00075 // Items marked with * are not implemented (i.e. %U, %V, %W) 00076 00077 // Returns the number of items printed 00078 static int dprintf(char *buf, const char *format, time_t tm); 00079 // Returns the output stream 00080 static ostream &dprintf(ostream &os, const char *format, time_t tm); 00081 00082 // Returns the number of items printed 00083 static int dprintf(char *buf, const char *format, 00084 const struct tm *tm); 00085 // Returns the output stream 00086 static ostream &dprintf(ostream &os, const char *format, 00087 const struct tm *tm); 00088 }; 00089 00090 #endif 00091
1.5.9