Compiler plug-in that provides date an time related expression terms.
The identifiers, functions and operators offered by this compiler plug-in introduce ALib types DateTime and TimePointBase::Duration to be used with module ALib Expressions.
All identifier and function names are defined case insensitive.
Constants:
Type | Name | Min. Abbreviation | Description |
---|---|---|---|
Integer | January | jan | Used to compare the result of functions GetMonth and GetUtcMonth. |
Integer | February | feb | Used to compare the result of functions GetMonth and GetUtcMonth. |
Integer | March | mar | Used to compare the result of functions GetMonth and GetUtcMonth. |
Integer | April | apr | Used to compare the result of functions GetMonth and GetUtcMonth. |
Integer | May | may | Used to compare the result of functions GetMonth and GetUtcMonth. |
Integer | June | jun | Used to compare the result of functions GetMonth and GetUtcMonth. |
Integer | July | jul | Used to compare the result of functions GetMonth and GetUtcMonth. |
Integer | August | aug | Used to compare the result of functions GetMonth and GetUtcMonth. |
Integer | September | sep | Used to compare the result of functions GetMonth and GetUtcMonth. |
Integer | October | oct | Used to compare the result of functions GetMonth and GetUtcMonth. |
Integer | November | nov | Used to compare the result of functions GetMonth and GetUtcMonth. |
Integer | December | dec | Used to compare the result of functions GetMonth and GetUtcMonth. |
Integer |Sunday | sun | Used to compare the result of functions GetDayOfWeek and GetUtcDayOfWeek. Integer |Monday | mon | Used to compare the result of functions GetDayOfWeek and GetUtcDayOfWeek. Integer |Tuesday | tue | Used to compare the result of functions GetDayOfWeek and GetUtcDayOfWeek. Integer |Wednesday| wed | Used to compare the result of functions GetDayOfWeek and GetUtcDayOfWeek. Integer |Thursday | thu | Used to compare the result of functions GetDayOfWeek and GetUtcDayOfWeek. Integer |Friday | fri | Used to compare the result of functions GetDayOfWeek and GetUtcDayOfWeek. Integer |Saturday | sat | Used to compare the result of functions GetDayOfWeek and GetUtcDayOfWeek.
Constant Constructor Functions:
Return Type | Name | Min. Abbreviation | Signature | Description |
---|---|---|---|---|
DateTime | DateTime | times | int,... | Returns a time stamp representing the calendar date in local time zone, respecting daylight saving. The first parameter is required and provides the year. Further parameters are optional and provide month (defaults to 1 ), dayOfMonth (defaults to 1 ), hour (defaults to 0 ), minute (defaults to 0 ) and millisecond (defaults to 0 ). |
DateTime | UtcDateTime | utcti | int,... | Returns a time stamp representing the calendar date in UTC time, not respecting daylight saving. The first parameter is required and provides the year. Further parameters are optional and provide month (defaults to 1 ), dayOfMonth (defaults to 1 ), hour (defaults to 0 ), minute (defaults to 0 ) and millisecond (defaults to 0 ). |
Duration | NanoSecondS | ns | int | Returns a time span object representing the given number of nanoseconds. |
Duration | MicroSecondS | mics | int | Returns a time span object representing the given (absolute) number of microseconds. |
Duration | MicroSecondS | mics | double | Returns a time span object representing the given (rational) number of microseconds. |
Duration | MillisecondS | ms | int | Returns a time span object representing the given (absolute) number of milliseconds. |
Duration | MillisecondS | ms | double | Returns a time span object representing the given (rational) number of milliseconds. |
Duration | SecondS | sec | int | Returns a time span object representing the given (absolute) number of seconds. |
Duration | SecondS | sec | double | Returns a time span object representing the given (rational) number of seconds. |
Duration | MinuteS | min | int | Returns a time span object representing the given (absolute) number of minutes. |
Duration | MinuteS | min | double | Returns a time span object representing the given (rational) number of minutes. |
Duration | Hours | hour | int | Returns a time span object representing the given (absolute) number of hours. |
Duration | Hours | hour | double | Returns a time span object representing the given (rational) number of hours. |
Duration | Days | day | int | Returns a time span object representing the given (absolute) number of days. |
Duration | Days | day | double | Returns a time span object representing the given (rational) number of days. |
Duration | Weeks | wee | int | Returns a time span object representing the given (absolute) number of weeks. |
Duration | Weeks | wee | double | Returns a time span object representing the given (rational) number of weeks. |
Duration | Months | mon | int | Returns a time span object representing the given (absolute) number of months (30 days). |
Duration | Months | mon | double | Returns a time span object representing the given (rational) number of months (30 days). |
Duration | Years | year | int | Returns a time span object representing the given (absolute) number of years (365 days). |
Duration | Years | year | double | Returns a time span object representing the given (rational) number of years (365 days). |
Functions:
Return Type | Name | Min. Abbreviation | Signature | Description |
---|---|---|---|---|
DateTime | Now | now | ./. | Returns the actual point in time. |
DateTime | Today | today | ./. | Returns the point in time that represents the current date local date at midnight, respecting the local time zone and daylight saving. |
DateTime | UtcToday | utoday | ./. | Returns the point in time that represents the current date local date at midnight, respecting UTC time zone without daylight saving. |
Duration | Age | age | DateTime | Returns the time span between the actual point in time and the given time stamp. |
Boolean | IsOlderThan | isot | DateTime ,Duration | Returns true if the time span between the actual point in time and the given point in time is greater than the given duration. |
Integer | GetYear | gy | DateTime | Returns the calendar year of the time stamp, respecting the local time zone and daylight saving. |
Integer | GetMonth | gmon | DateTime | Returns the calendar month of the time stamp, respecting the local time zone and daylight saving. |
Integer | GetDay | gd | DateTime | Returns the calendar day of the time stamp, respecting the local time zone and daylight saving. |
Integer | GetDayOfWeek | gdow | DateTime | Returns the calendar dayOfWeek of the time stamp, respecting the local time zone and daylight saving. |
Integer | GetHour | gh | DateTime | Returns the calendar hour of the time stamp, respecting the local time zone and daylight saving. |
Integer | GetMinute | gmin | DateTime | Returns the calendar Minute of the time stamp, respecting the local time zone and daylight saving. |
Integer | GetMilliSecond | gms | DateTime | Returns the calendar millisecond of the time stamp, respecting the local time zone and daylight saving. |
Integer | GetUtcYear | guy | DateTime | Returns the calendar year of the time stamp, respecting UTC time zone without daylight saving. |
Integer | GetUtcMonth | gumon | DateTime | Returns the calendar month of the time stamp, respecting UTC time zone without daylight saving. |
Integer | GetUtcDay | gud | DateTime | Returns the calendar day of the time stamp, respecting UTC time zone without daylight saving. |
Integer | GetUtcDayOfWeek | gudow | DateTime | Returns the calendar dayOfWeek of the time stamp, respecting UTC time zone without daylight saving. |
Integer | GetUtcHour | guh | DateTime | Returns the calendar hour of the time stamp, respecting UTC time zone without daylight saving. |
Integer | GetUtcMinute | gumin | DateTime | Returns the calendar minute of the time stamp, respecting UTC time zone without daylight saving. |
Integer | GetUtcMillisecond | gums | DateTime | Returns the calendar millisecond of the time stamp, respecting UTC time zone without daylight saving. |
Float | InDayS | ind | Duration | Returns the time span given in days. |
Float | InHourS | inh | Duration | Returns the time span given in hours. |
Float | InMinuteS | inmin | Duration | Returns the time span given in minutes. |
Float | InSecondS | ins | Duration | Returns the time span given in seconds. |
Float | InMilliSecondS | inms | Duration | Returns the time span given in milliseconds. |
Float | InMicroSecondS | inmics | Duration | Returns the time span given in microseconds. |
Float | InNanoSecondS | inns | Duration | Returns the time span given in nanoseconds. |
Float | InHertZ | inhz | Duration | Returns the time span given in hertz (1/second). |
Binary Operators:
Return Type | Lhs Type | Operator | Rhs Type | Description |
---|---|---|---|---|
DateTime | DateTime | + | Duration | Adds a time span to a time stamp. |
DateTime | Duration | + | DateTime | Adds a time span to a time stamp. |
DateTime | DateTime | - | DateTime | Subtracts two time stamps resulting in a time span. |
DateTime | DateTime | - | Duration | Subtracts a time span from time stamp. |
Duration | Duration | + | Duration | Adds two time spans. |
Duration | Duration | - | Duration | Subtracts rhs-value from lhs-value. |
Duration | Duration | * | Float | Multiplies a time span by a given floating point value. |
Duration | Float | * | Duration | Multiplies a time span by a given floating point value. |
Duration | Duration | * | Integer | Multiplies a time span by a given integral value. |
Duration | Integer | * | Duration | Multiplies a time span by a given integral value. |
Duration | Duration | / | Float | Divides a time span by a given floating point value. |
Duration | Duration | / | Integer | Divides a time span by a given integral value. |
Boolean | DateTime | == | DateTime | Compares two time stamp objects. |
Boolean | Duration | == | Duration | Compares two time span objects. |
Boolean | DateTime | != | DateTime | Compares two time stamp objects. |
Boolean | Duration | != | Duration | Compares two time span objects. |
Boolean | DateTime | < | DateTime | Compares two time stamp objects. |
Boolean | Duration | < | Duration | Compares two time span objects. |
Boolean | DateTime | <= | DateTime | Compares two time stamp objects. |
Boolean | Duration | <= | Duration | Compares two time span objects. |
Boolean | DateTime | > | DateTime | Compares two time stamp objects. |
Boolean | Duration | > | Duration | Compares two time span objects. |
Boolean | DateTime | >= | DateTime | Compares two time stamp objects. |
Boolean | Duration | >= | Duration | Compares two time span objects. |
Definition at line 149 of file dateandtime.hpp.
#include <dateandtime.hpp>
Public Static Method Index: | |
static ALIB_API void | Bootstrap () |
Public Method Index: | |
ALIB_API | DateAndTime (Compiler &compiler) |
virtual | ~DateAndTime () override |
Virtual destructor. | |
Public Method Index: inherited from Calculus | |
Calculus (const NString &name, Compiler &compiler, CompilePriorities pPriority) | |
virtual | ~Calculus () override |
Virtual destructor. | |
ALIB_API void | AddBinaryOpOptimizations (BinaryOpOptimizationsTableEntry *table, size_t length) |
template<size_t TCapacity> | |
void | AddBinaryOpOptimizations (BinaryOpOptimizationsTableEntry(&table)[TCapacity]) |
void | AddOperator (const String &op, Type lhsType, Type rhsType, CallbackDecl callback, const char *dbgCallbackName, Type resultType, CTInvokable cti) |
void | AddOperatorAlias (const String &alias, Type lhsType, Type rhsType, const String &op) |
void | AddOperatorAliases (OperatorAliasTableEntry *table, size_t length) |
template<size_t TCapacity> | |
void | AddOperatorAliases (OperatorAliasTableEntry(&table)[TCapacity]) |
ALIB_API void | AddOperators (OperatorTableEntry *table, size_t length) |
template<size_t TCapacity> | |
void | AddOperators (OperatorTableEntry(&table)[TCapacity]) |
virtual ALIB_API bool | TryCompilation (CIAutoCast &autoCast) override |
virtual ALIB_API bool | TryCompilation (CIBinaryOp &ciBinaryOp) override |
virtual ALIB_API bool | TryCompilation (CIFunction &ciFunction) override |
virtual ALIB_API bool | TryCompilation (CIUnaryOp &ciUnaryOp) override |
Public Method Index: inherited from CompilerPlugin | |
CompilerPlugin (const NString &name, Compiler &compiler, CompilePriorities pPriority) | |
virtual | ~CompilerPlugin () |
Virtual destructor. | |
Public Method Index: inherited from Plugin< Compiler, CompilePriorities > | |
PrioritiesType | GetPriority () const |
Additional Inherited Members | |
Public Type Index: inherited from Calculus | |
using | BinaryOpOptimizationsTableEntry = const std::tuple<String, lang::Side, Type, const Box&, const Box&> |
using | CTInvokable = bool |
using | OperatorAliasTableEntry = const std::tuple<String, Type, Type, String> |
using | OperatorTableEntry |
Public Type Index: inherited from Plugin< Compiler, CompilePriorities > | |
using | PluginType |
This exposes the template parameter TPlugin to the outer world. | |
using | PrioritiesType |
This exposes the template parameter pTPlugin to the outer world. | |
Public Static Field Index: inherited from Calculus | |
static constexpr CTInvokable | CTI = true |
static constexpr CTInvokable | ETI = false |
Public Field Index: inherited from Calculus | |
MonoAllocator | allocator |
std::vector< AutoCastEntry > | AutoCasts |
List of auto-casts to be compiled by this plug-in. | |
HashMap< MonoAllocator, BinOpOptKey, Box, BinOpOptKey::Hash, BinOpOptKey::EqualTo > | BinaryOperatorOptimizations |
std::vector< ConstantIdentifierEntry > | ConstantIdentifiers |
List of identifiers that return constant values to be compiled by this plug-in. | |
std::vector< FunctionEntry > | Functions |
List of functions to be compiled by this plug-in. | |
HashMap< MonoAllocator, OperatorKey, String, OperatorKey::Hash, OperatorKey::EqualTo > | OperatorAliases |
HashMap< MonoAllocator, OperatorKey, std::tuple< CallbackDecl, Box, CTInvokable ALIB_DBG(, const char *) >, OperatorKey::Hash, OperatorKey::EqualTo > | Operators |
Public Field Index: inherited from CompilerPlugin | |
Compiler & | Cmplr |
The compiler that this plug-in is attached to. | |
const NString | Name |
Protected Field Index: inherited from Plugin< Compiler, CompilePriorities > | |
PrioritiesType | priority |
The priority of this plug-in. | |
Protected Method Index: inherited from Plugin< Compiler, CompilePriorities > | |
Plugin (PrioritiesType pPriority) | |
ALIB_API DateAndTime | ( | Compiler & | compiler | ) |
Constructor. Creates the hash maps.
compiler | The compiler we will get attached to. |
|
inlineoverridevirtual |
Virtual destructor.
Definition at line 160 of file dateandtime.hpp.
|
static |
Static initialization function. Called once during library initialization.