GTimestamp Class Reference

[libgfc Index] [libgfc Hierarchy] [Headers]


GFC's timestamp class More...

#include <src/gadt_time.h>

Inherits: GTemporal

Public Members


Detailed Description

GFC's timestamp class.

GTimestamp is based on the work by MultiCal project of U.

Arizona.

GLOSSARY

CHRONON: Unit of time measuring as adopted by a clock. A second

for our purpose. (Would geographical features be

measured to a microsecond??)

TIMESTAMP: A paticular time in the history. Defined by the

number of chronons from the origin.

SPAN: A period of time. A FIXED span is just a count of

chronons; while a VARIABLE span (line a 'month')

may have a duration that depends on a paticular calendar.

ORIGIN: We specify "Midnight January 1, 1970 GMT" as the origin for

timestamps (same as the unix time origin.) This is merely

a reference point. The actual timestamp represented can

cover the whole history of the Earth, using just 64 bits.

TIMESTAMP FORMAT:

We use a 64 bit integer to represent the timestamp.

The bits pattern is as below:

63 0

xxxx,x,xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

| | |

| | seconds from the ORIGIN (59 bits; good for 36 billion years)

| sign (1:after ORIGIN, 0: before ORIGIN)

type (see below)

Type:

1100: for special timestamps ("beginning", "forever",and null).

C000000000000001 = beginning (big bang)

C000000000000002 = forever (big crunch?)

C000000000000000 = NULL timestamp.

0100: a regular timestamp.

0010: a fixed span or duration (sign is meaningless here)

1111: a variable span. (to be defined -- L.Q.)


unsigned secs_lo : 32[public]

timestamp internal representation.

timestamp_internal ts[public]

actual storage: 64 bits whatsoever.

GTimestamp() [public]

constructors

Result input(const char* in) [public virtual]

translate a GMT user time gregorian date into a timestamp. The user format must be exact as "Oct 09 12:23:45 1996"

Result output(char*& out) [public virtual]

translates a timestamp into GMT user format, with the form of "Oct 09 12:23:45 GMT 1996". To translate GMT time into local time, use system library functions.

Result output(char*& out, TimeUnit u ) [public]

same as output; except in a terse format according to theunit of the timestamp.

Result scale(int) [public virtual]

change the temporal scale of this value

int before(const GTemporal& a) const [public virtual]

check if this temporal value is Earlier Than 'a'

int after(const GTemporal& a) const [public virtual]

check if this temporal value is Later than 'a'

int during(const GTemporal& a) const [public virtual]

check if this temporal value is during 'a'

int overlap(const GTemporal& a) const [public virtual]

check if this temporal value overlaps 'a'

operator int64 ()() const [public]

type conversion (timestamp -> int64)

Result date2TS(const GDate* date) [public]

convert a gregorian date into timestamp (seconds since origin.) Originally written by "MultiCal" group; modified to support hour/min/sec.

void setDate(const GDate& date) [public]

handy versionf of date2TS

Result date(GDate* date) const [public]

Translate from seconds format to explicit Greogrian date. Original version by "MultiCal" group; modified to support hour/min/sec.

Result timeLabel(TimeUnit unit, char* str) [public]

Return a time label that is in user format and in accordance to the precision. (For example, if the precision is set to year, the time label will only includ the year number, such as "1996", instead of "JAN 1 00:00:00 1996".)

void setYear(int year) [public]

set timestamp to just indicate the year.

void setToOrigin() [public]

This method turns the timestamp into a special one representing beginning of the universe (big bang). This timestamp is smaller than any other timestamp.

void setToForever() [public]

This turns the timestamp into a "forever" one, which is greater than any other timestamp.

void setToSpan(int64 span=-1) [public]

This method turn the timestamp into a fixed span.


Documentation generated by lqian@lqian-sun on Wed Jul 14 09:36:10 EDT 1999
Kdoc