PTypes: date/time: time

Top: Basic types: Date/time: Time manipulation

>     #include <ptime.h>

>     typedef large datetime;

>     bool     istimevalid(int hour, int min, int sec, int msec = 0);
>     datetime encodetime(int hour, int min, int sec, int msec = 0);
>     bool     decodetime(datetime d, int& hour, int& min, int& sec [, int& msec] );

bool istimevalid(int hour, int min, int sec, int msec = 0) checks whether hour, min, sec and msec (millisecond) contain correct values in their respective ranges. The last parameter is optional.

datetime encodetime(int hour, int min, int sec, int msec = 0) returns a datetime value, i.e. the number of milliseconds since midnight. This function does NOT check the input parameters for validity. The value returned by this function can be added to the return value of encodedate() to form the exact time stamp for the given year, month, day, hour, minute, second and (optionally) millisecond.

bool decodetime(datetime d, int& hour, int& min, int& sec [, int& msec] ) splits the value of d into hour, minute, sec and msec (millisecond) passed since midnight. The last parameter is optional.

See also: Datetime type, Date/calendar manipulation

PTypes home