#include <cassert>
#include <cstdio>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <cerrno>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <unistd.h>
#include "hash.h"
#include "id.h"
#include "data.h"
#include "trace.h"
#include "kbase.h"
#include "dictionary.h"
#include "util.h"
#include "ondisk.h"
#include "calendar.h"
#include "gabbie.h"
#include "time.h"
Classes | |
struct | TimeContext |
Functions | |
int | DayOfWeek (int day) |
int | IdToDayOfWeek (Id dayId) |
double | StrToDate (char *s) |
Convert string with date in format YYYYMMDDHHMMSS to date in double. | |
int | IsLeapYear (int year) |
double | EdtToTime (ExpandedDateTime *p) |
Convert ExpandedDateTime struct to date+time represented as a double. | |
void | TimeToEdt (ExpandedDateTime *p, double time) |
Expand date+time represented as a double to ExandedDateTime struct. | |
double | GetCurrentTime () |
Returns a double representing the current date+time. | |
void | PrintTime (double d, int full) |
Print time. | |
void | TestTime (char *timeStr) |
For test purposes, force current time to timeStr in YYYYMMDDHHMMSS format. | |
char * | HourToText (int hour, int minute) |
Data * | TimeAct (Context *p) |
Variables | |
int | sMonthDayTotal [] |
char * | sMonthTab [] |
char * | sDowTab [] |
|
Calculate day-of-week, where Sunday==0, Monday==1 .. Saturday=6 The day parameter is the integer part of a time (in double format). |
|
Convert ExpandedDateTime struct to date+time represented as a double. Convert ExpandedDateTime struct to date+time represented as a double. See TimeToEdt() for explanation of date+time as a double. The value in p->mLeapFlag is ignored. Values are not checked to confirm they are in their appropriate ranges. TODO: This should be a method of EDT. |
|
Returns a double representing the current date+time. Returns a double representing the current date+time. Note: If a value is specified by TestTime() it will overide local current time. |
|
|
|
Convert gIdSunday=0, gIdMonday=1 .. gIdSaturday=6 Return -1 if Id doesn not match gIdSunday .. gIdSaturday |
|
|
|
Print time.
|
|
Convert string with date in format YYYYMMDDHHMMSS to date in double.
|
|
For test purposes, force current time to timeStr in YYYYMMDDHHMMSS format. For test purposes, force current time to time specificied by timeStr in YYYYMMDDHHMMSS format. This is accomplished by forcing GetCurrentTime() to return the time specified rather than the current time. |
|
|
|
Expand date+time represented as a double to ExandedDateTime struct. Expand date+time represented as a double to ExpandedDateTime struct. When date+time is represented as a double, the integer portion (which can be negative) represents the number of days since Jan 1, 1900. The fractional part of the double represents the fraction of the 24 hour day that has elapsed. Example: 0.5 == 12:00 noon, 0.25 = 6:00 AM. Note: This conversion takes into account the fairly complicated rule for leap days (leap year if divisible by 4, but not 100, unless also divisible by 400). So 2000 is a leap year, while 1900 and 1800 were not. Limitations:
TODO: This should be a method of EDT. |
|
Initial value: { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" } |
|
Initial value: { 0, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 } |
|
Initial value: { "Unused", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" } |