Defines | Functions | Variables

date.cpp File Reference

#include "date.h"
#include <sstream>
#include <time.h>
#include <math.h>
Include dependency graph for date.cpp:

Go to the source code of this file.

Defines

#define MONTH_ENTRY(name, month)   { #name , month },

Functions

static const char * get_month_display (IN int month) throw ()
static double my_trunc (IN double x) throw ()
int GetMonthFromString (IN const char *month) throw ()
void getDisplayableDateFromNetTime (IN long time, OUT std::string &display)
const char * getDateString (IN long timestamp)
void getDateStringFromNetTime (IN long time, OUT std::string &display)
static const char * extractInteger (IN const char *s, IN char separator, OUT int &x, IN int min, IN int max, IN int digits_required) throw ()
static const char * extractString (IN const char *s, IN char separator, IO char *buf, IN int size) throw ()
long getNetTimeFromDateString (IN const char *s) throw ()
int getWeekdayFromNetTime (IN long time) throw ()
const char * GetWeekday (IN int weekday_index) throw ()
const char * GetMonth (IN int month_index) throw ()
long getDayBucket (IN long timestamp) throw ()
long getWeekBucket (IN long timestamp) throw ()
long getMonthBucket (IN long timestamp) throw ()
long getYearBucket (IN long timestamp) throw ()
std::string getDayBucketName (IN long day_bucket)
std::string getWeekBucketName (IN long week_bucket)
std::string getMonthBucketName (IN long month_bucket)
std::string getYearBucketName (IN long year_bucket)

Variables

static const long s_secondsPerDay = 24 * 3600
static const long s_secondsPerWeek = 7 * s_secondsPerDay
static const long s_firstSunday = 3 * s_secondsPerDay
static const month_entry_t s_Months []
static const char * s_MonthsDisplay []
static const char * s_Weekdays []

Define Documentation

#define MONTH_ENTRY (   name,
  month 
)    { #name , month },

Definition at line 66 of file date.cpp.


Function Documentation

static const char* get_month_display ( IN int  month  )  throw () [static]

Definition at line 168 of file date.cpp.

static double my_trunc ( IN double  x  )  throw () [static]

Definition at line 183 of file date.cpp.

void getDisplayableDateFromNetTime ( IN long  time,
OUT std::string &  display 
)

Definition at line 236 of file date.cpp.

const char* getDateString ( IN long  timestamp  ) 

Definition at line 261 of file date.cpp.

void getDateStringFromNetTime ( IN long  time,
OUT std::string &  display 
)

Definition at line 282 of file date.cpp.

static const char* extractInteger ( IN const char *  s,
IN char  separator,
OUT int &  x,
IN int  min,
IN int  max,
IN int  digits_required 
) throw () [static]

Definition at line 296 of file date.cpp.

static const char* extractString ( IN const char *  s,
IN char  separator,
IO char *  buf,
IN int  size 
) throw () [static]

Definition at line 337 of file date.cpp.

long getNetTimeFromDateString ( IN const char *  s  )  throw ()

Definition at line 369 of file date.cpp.

int getWeekdayFromNetTime ( IN long  time  )  throw ()

Definition at line 430 of file date.cpp.

const char* GetWeekday ( IN int  weekday_index  )  throw ()

Definition at line 446 of file date.cpp.

const char* GetMonth ( IN int  month_index  )  throw ()

Definition at line 461 of file date.cpp.

long getDayBucket ( IN long  timestamp  )  throw ()

Definition at line 477 of file date.cpp.

long getWeekBucket ( IN long  timestamp  )  throw ()

Definition at line 491 of file date.cpp.

long getMonthBucket ( IN long  timestamp  )  throw ()

Definition at line 505 of file date.cpp.

long getYearBucket ( IN long  timestamp  )  throw ()

Definition at line 521 of file date.cpp.

std::string getDayBucketName ( IN long  day_bucket  ) 

Definition at line 537 of file date.cpp.

std::string getWeekBucketName ( IN long  week_bucket  ) 

Definition at line 548 of file date.cpp.

std::string getMonthBucketName ( IN long  month_bucket  ) 

Definition at line 558 of file date.cpp.

std::string getYearBucketName ( IN long  year_bucket  ) 

Definition at line 570 of file date.cpp.


Variable Documentation

const long s_secondsPerDay = 24 * 3600 [static]

Definition at line 44 of file date.cpp.

const long s_secondsPerWeek = 7 * s_secondsPerDay [static]

Definition at line 45 of file date.cpp.

const long s_firstSunday = 3 * s_secondsPerDay [static]

Definition at line 47 of file date.cpp.

const month_entry_t s_Months[] [static]

Definition at line 68 of file date.cpp.

const char* s_MonthsDisplay[] [static]
Initial value:
 {
        "jan",
        "feb",
        "mar",
        "apr",
        "may",
        "jun",
        "jul",
        "aug",
        "sep",
        "oct",
        "nov",
        "dec"
}

Definition at line 131 of file date.cpp.

const char* s_Weekdays[] [static]
Initial value:
 {
        "sun",
        "mon",
        "tue",
        "wed",
        "thu",
        "fri",
        "sat"
}

Definition at line 148 of file date.cpp.