Granada  1.54.0
Structured layer on top of C++ REST SDK for building server applications in C++. Granada implements sessions, server side plug-in framework, C++ OAuth 2.0 server, data storage access, server script running, server browsing.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
Functions
granada::util::time Namespace Reference

Functions

static std::time_t parse (const std::string &time_str)
 
static std::string stringify (const std::time_t &_time)
 
static bool is_timedout (const std::time_t &_time, const long int &timeout, const long int &extra_seconds)
 
static bool is_timedout (const std::time_t &_time, const long int &timeout)
 
static int get_milliseconds ()
 
static int get_milliseconds_span (int start)
 
static void sleep_seconds (int seconds)
 
static void sleep_milliseconds (int milliseconds)
 

Detailed Description

Utils for measuring and manipulating time.

Function Documentation

static int granada::util::time::get_milliseconds ( )
static

Returns the current time in milliseconds.

Returns
Current time in milliseconds.
static int granada::util::time::get_milliseconds_span ( int  start)
static

Returns the span in milliseconds between the current time and a given time in milliseconds.

Parameters
Timein milliseconds.
Returns
Span in milliseconds between current time and the given time.
static bool granada::util::time::is_timedout ( const std::time_t &  _time,
const long int &  timeout,
const long int &  extra_seconds 
)
static

Returns true if the difference in seconds between now and the given time is higher than the given timeout seconds plus an extra seconds.

Parameters
_timeTime to compare with now
timeoutTimeout, minimum difference in seconds now and given time should have to not being considered timedout. If -1 is considered infinite+.
extra_secondsExtra seconds to sum to timeout.
Returns
True if timedout false if not.
static bool granada::util::time::is_timedout ( const std::time_t &  _time,
const long int &  timeout 
)
inlinestatic

Returns true if the difference in seconds between now and the given time is higher than the given timeout.

Parameters
_timeTime to compare with now
timeoutTimeout, minimum difference in seconds now and given time should have to not being considered timedout. If -1 is considered infinite+.
Returns
True if timedout false if not.
static std::time_t granada::util::time::parse ( const std::string &  time_str)
static

Parse a string containing time into time_t

Parameters
time_strStringified time
Returns
Parsed time.
static void granada::util::time::sleep_milliseconds ( int  milliseconds)
inlinestatic

Stops thread n given milliseconds.

Parameters
millisecondsMilliseconds to stop thread.
static void granada::util::time::sleep_seconds ( int  seconds)
inlinestatic

Stops thread n given seconds.

Parameters
secondsSeconds to stop thread.
static std::string granada::util::time::stringify ( const std::time_t &  _time)
static

Stringify time_t.

Parameters
_timeTime to stringify.
Returns
Stringified time.