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 (int month) throw ()
static double my_trunc (double x) throw ()
int GetMonthFromString (const char *month) throw ()
void getDisplayableDateFromNetTime (long time, std::string &display)
const char * getDateString (long timestamp)
void getDateStringFromNetTime (long time, std::string &display)
static const char * extractInteger (const char *s, char separator, int &x, int min, int max, int digits_required) throw ()
static const char * extractString (const char *s, char separator, char *buf, int size) throw ()
long getNetTimeFromDateString (const char *s) throw ()
int getWeekdayFromNetTime (long time) throw ()
const char * GetWeekday (int weekday_index) throw ()
const char * GetMonth (int month_index) throw ()
long getDayBucket (long timestamp) throw ()
long getWeekBucket (long timestamp) throw ()
long getMonthBucket (long timestamp) throw ()
long getYearBucket (long timestamp) throw ()
std::string getDayBucketName (long day_bucket)
std::string getWeekBucketName (long week_bucket)
std::string getMonthBucketName (long month_bucket)
std::string getYearBucketName (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 ( int  month  )  throw () [static]

Definition at line 168 of file date.cpp.

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

Definition at line 183 of file date.cpp.

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

Definition at line 235 of file date.cpp.

const char* getDateString ( long  timestamp  ) 

Definition at line 259 of file date.cpp.

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

Definition at line 279 of file date.cpp.

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

Definition at line 293 of file date.cpp.

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

Definition at line 334 of file date.cpp.

long getNetTimeFromDateString ( const char *  s  )  throw ()

Definition at line 366 of file date.cpp.

int getWeekdayFromNetTime ( long  time  )  throw ()

Definition at line 427 of file date.cpp.

const char* GetWeekday ( int  weekday_index  )  throw ()

Definition at line 443 of file date.cpp.

const char* GetMonth ( int  month_index  )  throw ()

Definition at line 458 of file date.cpp.

long getDayBucket ( long  timestamp  )  throw ()

Definition at line 474 of file date.cpp.

long getWeekBucket ( long  timestamp  )  throw ()

Definition at line 488 of file date.cpp.

long getMonthBucket ( long  timestamp  )  throw ()

Definition at line 502 of file date.cpp.

long getYearBucket ( long  timestamp  )  throw ()

Definition at line 517 of file date.cpp.

std::string getDayBucketName ( long  day_bucket  ) 

Definition at line 532 of file date.cpp.

std::string getWeekBucketName ( long  week_bucket  ) 

Definition at line 543 of file date.cpp.

std::string getMonthBucketName ( long  month_bucket  ) 

Definition at line 553 of file date.cpp.

std::string getYearBucketName ( long  year_bucket  ) 

Definition at line 565 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.