Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

dsDate.h

Go to the documentation of this file.
00001 /* 
00002  * $Id: dsDate.h,v 1.11 2003/09/24 11:34:16 dsamersoff Exp $
00003  */
00004 
00005 #ifndef dsDate_h
00006 #define dsDate_h
00007 
00008 #ifdef HAVE_CONFIG_H
00009 # include <config.h>
00010 #endif
00011 
00012 #include <stdio.h>
00013 #include <stdlib.h>
00014 #include <string.h>
00015 
00016 #ifdef HAVE_STRINGS_H
00017 # include <strings.h>
00018 #endif
00019 
00020 #include <time.h>
00021 
00022 #include <iostream>
00023 
00024 #include <dsSmartException.h>
00025 #include <dsform.h>
00026 
00027 DECLARE_EXCEPTION(dsDate);
00028 
00029 
00030 #define BASE_YEAR   70
00031 #define MAX_YEAR  3100
00032 #define YEAR_OFFS 1900
00033 #define LAST_MON    11
00034 #define LAST_MDAY   31
00035 #define LAST_HOUR   23
00036 #define LAST_MIN    59
00037 #define LAST_SEC    59
00038 
00039 /* affect wday parameter interpretation for dt_nearest
00040  */
00041 #define WEEK_STARTS_MON
00042 
00043 
00044 /* Freq Used formats */
00045 /*ctime out: [Fri Dec 18 13:14:56 1998\n] */
00046 #define DF_CTIME   "... Aaa dd hh:mm:ss YYYY"
00047 #define DF_EUDATE  "DD/MM/YY hh:mm:ss"
00048 #define DF_EUDATEL "DD/MM/YYYY hh:mm:ss"
00049 #define DF_USDATE  "MM/DD/YY hh:mm:ss"
00050 #define DF_USDATEL "MM/DD/YYYY hh:mm:ss"
00051 
00068 time_t dt_convert(const char *format, std::istream& is);
00069 time_t dt_convert(const char *format, const char *in);
00070 
00071 inline time_t dt_convert(std::istream& is, const char *format)
00072 { return dt_convert(format, is);
00073 }
00074 
00079 std::ostream& dt_format(std::ostream& dest, char *format, time_t time);
00080 char *dt_format(char *dest, int max_size,  char *format, time_t t );
00081 
00082 
00084 int dt_interval(char *src, char **newptr = 0);
00085 
00086 
00092 time_t dt_round( time_t t, char *what = "-d");
00093 
00105 time_t dt_nearest(int year, int mont, int mday, int wday, int hour = -1, int min = -1);
00106 
00107 inline time_t dt_nearest(struct tm *tm)
00108 { return dt_nearest(tm->tm_year + YEAR_OFFS, tm->tm_mon+1, tm->tm_mday, tm->tm_wday, tm->tm_hour, tm->tm_min);
00109 } 
00110 
00111 #endif

Generated on Mon May 16 18:26:57 2005 for libdms4 by doxygen1.3-rc2