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

dsDate.h File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <iostream>
#include <dsSmartException.h>
#include <dsform.h>

Go to the source code of this file.

Defines

#define BASE_YEAR   70
#define MAX_YEAR   3100
#define YEAR_OFFS   1900
#define LAST_MON   11
#define LAST_MDAY   31
#define LAST_HOUR   23
#define LAST_MIN   59
#define LAST_SEC   59
#define WEEK_STARTS_MON
#define DF_CTIME   "... Aaa dd hh:mm:ss YYYY"
#define DF_EUDATE   "DD/MM/YY hh:mm:ss"
#define DF_EUDATEL   "DD/MM/YYYY hh:mm:ss"
#define DF_USDATE   "MM/DD/YY hh:mm:ss"
#define DF_USDATEL   "MM/DD/YYYY hh:mm:ss"

Functions

 DECLARE_EXCEPTION (dsDate)
time_t dt_convert (const char *format, std::istream &is)
time_t dt_convert (const char *format, const char *in)
time_t dt_convert (std::istream &is, const char *format)
std::ostream & dt_format (std::ostream &dest, char *format, time_t time)
char * dt_format (char *dest, int max_size, char *format, time_t t)
int dt_interval (char *src, char **newptr=0)
time_t dt_round (time_t t, char *what="-d")
time_t dt_nearest (int year, int mont, int mday, int wday, int hour=-1, int min=-1)
time_t dt_nearest (struct tm *tm)


Define Documentation

#define BASE_YEAR   70
 

#define DF_CTIME   "... Aaa dd hh:mm:ss YYYY"
 

#define DF_EUDATE   "DD/MM/YY hh:mm:ss"
 

#define DF_EUDATEL   "DD/MM/YYYY hh:mm:ss"
 

#define DF_USDATE   "MM/DD/YY hh:mm:ss"
 

#define DF_USDATEL   "MM/DD/YYYY hh:mm:ss"
 

#define LAST_HOUR   23
 

#define LAST_MDAY   31
 

#define LAST_MIN   59
 

#define LAST_MON   11
 

#define LAST_SEC   59
 

#define MAX_YEAR   3100
 

#define WEEK_STARTS_MON
 

#define YEAR_OFFS   1900
 


Function Documentation

DECLARE_EXCEPTION dsDate   
 

time_t dt_convert std::istream &    is,
const char *    format
[inline]
 

time_t dt_convert const char *    format,
const char *    in
 

time_t dt_convert const char *    format,
std::istream &    is
 

convert string to date according to format specified format descripption: YY - two digit year YYYY - four digit year MM - two digit month Aaa - Abreviated Three-letter month DD - two digid mday dd - one or two digit mday (mail style) hh,mm,ss - time hoursi (24h), minits, secons

' '(space) - skip all white spaces '.'(dot) - skip any character at this position ';'(semicolon) - remove rest of input

char* dt_format char *    dest,
int    max_size,
char *    format,
time_t    t
 

todo: make it real function

std::ostream& dt_format std::ostream &    dest,
char *    format,
time_t    time
 

convert timestamp to string according to format specified, very close to strftime, but use time_t instead of struct tm and format specified as for dt_convert

int dt_interval char *    src,
char **    newptr = 0
 

convert interval to sec from 1h60m30s notation

time_t dt_nearest struct tm *    tm [inline]
 

time_t dt_nearest int    year,
int    mont,
int    mday,
int    wday,
int    hour = -1,
int    min = -1
 

return date nearest to passed, if you specify wday it return nearest date after specified or today with matching wday

-1 means '*' wday = 0 to 6 (if defined WEEK_START_MON 0 means MON else SUN) mon = 1 to 12 year should be with century (e.g. 2003);

time_t dt_round time_t    t,
char *    what = "-d"
 

return date part of date_time -d = to day down +d to day up -w = to week down +d to week up -m = to month down +m to month up


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