Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

CdbTimeUtils Class Reference

A utility class for manipulations with objects of the BdbTime class. More...

#include <CdbTimeUtils.hh>

List of all members.

Static Public Member Functions

bool string2time (BdbTime &theTime, const char *theString)
 Translate a string into an object of BdbTime.

bool string2time (BdbTime &theTime, const std::string &theString)
 Translate a string into an object of BdbTime.

std::string time2string (const BdbTime &theTime, bool forceInternalFormat=false, bool packedFormat=false)
 Translate an object of BdbTime into a string.

std::string time2string2 (const BdbTime &theTime, BdbTime::Zone theTimeZone=BdbTime::Local, bool forceInternalFormat=false, bool packedFormat=false)
 Translate an object of BdbTime into a string.

std::string get_current_timestamp ()
 Get the current timestamp.

BdbTime from_nsec (unsigned long long theNumber)
 Translate a 64-bit number of nanoseconds into an object of BdbTime.

unsigned long long to_nsec (const BdbTime &theTime)
 Translate an object of BdbTime class into a 64-bit number of nanoseconds.


Detailed Description

A utility class for manipulations with objects of the BdbTime class.

This is a collection of most common operations with BdbTime done in in the context of CDB API, its implementations, and its clients.

Definition at line 18 of file CdbTimeUtils.hh.


Member Function Documentation

BdbTime CdbTimeUtils::from_nsec unsigned long long    theNumber [static]
 

Translate a 64-bit number of nanoseconds into an object of BdbTime.

A number on the input is supposed to be a previously packed value of a BdbTime object.

The overflow is returned as BdbTime::plusInfinity

Definition at line 133 of file CdbTimeUtils.cc.

References BdbTimeConst::nsecInASec, BdbTime::plusInfinity, and BdbTimeConst::plusInfinity.

Referenced by CdbMySQLSelectQuery::checked_get(), and CdbMySQLSelectQuery::get().

std::string CdbTimeUtils::get_current_timestamp   [static]
 

Get the current timestamp.

This utility function would produce a string with the current timestamp in the following format:

monthDay_hour::minute::sec.milisec

Definition at line 112 of file CdbTimeUtils.cc.

bool CdbTimeUtils::string2time BdbTime   theTime,
const std::string &    theString
[static]
 

Translate a string into an object of BdbTime.

A variation of the above explained method.

Definition at line 60 of file CdbTimeUtils.cc.

References string2time().

bool CdbTimeUtils::string2time BdbTime   theTime,
const char *    theString
[static]
 

Translate a string into an object of BdbTime.

This utility method would attempt to translate the specified string into an object of the BdbTime class if this is possible. A non zero pointer onto a string is expected.

NOTE; Unlike the standard method of translating time available through

BdbTime::parseTime()

the current one will also recognize an internal numeric format of time.

If the translation will be successfull then the resulting flag would be set to "true" and the reference would be properly initialized. Otherwise the reference would not be affected.

Returns:
a boolen flag indicating the result of the translation.
Parameters:
theTime  the value to be initialized
theString  the input string

Definition at line 24 of file CdbTimeUtils.cc.

References BdbTime::parseTime().

Referenced by main(), CdbBrowserTool::run(), and string2time().

std::string CdbTimeUtils::time2string const BdbTime   theTime,
bool    forceInternalFormat = false,
bool    packedFormat = false
[static]
 

Translate an object of BdbTime into a string.

The method would return a string with an internal representation of time:

.

The only exception of this rule is for the value of BdbTime::minusInfinity and BdbTime::plusInfinity. By default they would be printed as:

" -Infinity " " +Infinity "

unless an optional flag "forceInternalFormat" is set to "true".

By default the resulting string will be of afixed length: 11+1+11=23 characters unless an optional flag "packedFormat" is set to "true".

Returns:
a string representation of the input object.
Parameters:
theTime  the input object to be translated
forceInternalFormat  the format control flag for "infinity" values
packedFormat  the format control flag

Definition at line 68 of file CdbTimeUtils.cc.

References BdbTime::getGmtNsec(), BdbTime::getGmtSec(), BdbTime::minusInfinity, and BdbTime::plusInfinity.

Referenced by CdbMySQLOrigin::close_partition(), CdbBdbSCondition::createRevision(), CdbSQLVisibleObject::dump(), CdbSQLView::dump(), CdbSQLRevision::dump(), CdbSQLPartitionIncrement::dump(), CdbSQLPartition::dump(), CdbSQLOriginalObject::dump(), CdbSQLOrigin::dump(), CdbSQLPartitionInterval::dump(), CdbSQLFolder::dump(), CdbSQLConditionAtFolder::dump(), CdbSQLCondition::dump(), CdbSQLClusterIncrement::dump(), CdbSQLCluster::dump(), CdbSQLCell::dump(), CdbRooRoViewR::dump(), CdbRooRoTimeLineR< V >::dump(), CdbRooRoRevisionR::dump(), CdbRooRoRevCollectionR::dump(), CdbRooRoRegistry::dump(), CdbRooRoPartitionIntervalR::dump(), CdbRooRoPartitionR::dump(), CdbRooRoOriginR::dump(), CdbRooRoOiCollectionR::dump(), CdbRooRoMetaDataR::dump(), CdbRooRoIncrementR::dump(), CdbRooRoFolderR::dump(), CdbRooRoConditionR::dump(), CdbRooRoConditionAtFolderR::dump(), CdbRooRoClusterR::dump(), CdbRooRoCi::dump(), CdbRooRoCellR::dump(), CdbMySQLSelectQuery::execute_query(), CdbRooRoRevCollectionR::find(), CdbSQLOrigin::find_next_final_partition(), CdbRooRoMetaDataR::findByRevision(), CdbSQLApiCondition::findObject(), CdbRooRoCondition::findObject(), CdbRooRoConfigCollectionR::insert(), main(), CdbRooRoMetaDataR::objectIterator(), operator<<(), CdbSQLApiCondition::originalObjectIterator(), CdbRooEnvProxy< T, R >::redefinedFaultHandler(), CdbEnvProxy< T >::redefinedFaultHandler(), CdbBdbEnvProxy< T, P >::redefinedFaultHandler(), CdbSQLApiCondition::storeObject(), time2string2(), CdbRooRoOiR::toString(), CdbRooProxyCache::updateCache(), and CdbProxyCache::updateCache().

std::string CdbTimeUtils::time2string2 const BdbTime   theTime,
BdbTime::Zone    theTimeZone = BdbTime::Local,
bool    forceInternalFormat = false,
bool    packedFormat = false
[static]
 

Translate an object of BdbTime into a string.

The method would return a string with an internal representation of time followed by its human readable string:

3123456789.0987654321 : Wed 15 Jan 2005 10:11:00 (local timezone) 0 ns

See also:
CdbTimeUtils::time2string()
Parameters:
theTime  the input object to be translated
theTimeZone  the way we're interpreting the time
forceInternalFormat  the format control flag for "infinity" values
packedFormat  the format control flag

Definition at line 95 of file CdbTimeUtils.cc.

References BdbTime::asString(), BdbTime::getGmtNsec(), and time2string().

Referenced by CdbMySQLCondition::create_revision(), and main().

unsigned long long CdbTimeUtils::to_nsec const BdbTime   theTime [static]
 

Translate an object of BdbTime class into a 64-bit number of nanoseconds.

A number on the input is supposed to be a previously packed value of a BdbTime object.

Definition at line 146 of file CdbTimeUtils.cc.

References BdbTime::getGmtNsec(), BdbTime::getGmtSec(), and BdbTimeConst::nsecInASec.

Referenced by CdbMySQLOrigin::close_partition(), CdbMySQLOrigin::create_cluster(), CdbMySQLOrigin::create_condition(), CdbMySQLFolder::create_folder(), CdbMySQLOrigin::create_partition(), CdbMySQLCondition::create_revision(), CdbMySQL::create_slave_origin(), CdbMySQLOrigin::create_view(), CdbMySQLConditionAtFolder::find_config_element(), CdbMySQLOrigin::find_partition(), CdbMySQLCondition::find_revision(), CdbMySQLOrigin::find_topmost_partition(), CdbMySQLFolder::include_condition(), CdbMySQL::initialize_master_origin(), CdbMySQLOrigin::instantiate_partition(), CdbMySQLCondition::original_objects(), CdbMySQLConditionAtFolder::set_config(), CdbMySQLCondition::store_object(), CdbMySQL::synchronize_master(), CdbMySQLCondition::topmost_revision_id(), and CdbMySQLPartition::update().


The documentation for this class was generated from the following files:
Generated on Mon Dec 5 18:22:27 2005 for CDB by doxygen1.3-rc3