本文整理汇总了C++中time_duration::total_seconds方法的典型用法代码示例。如果您正苦于以下问题:C++ time_duration::total_seconds方法的具体用法?C++ time_duration::total_seconds怎么用?C++ time_duration::total_seconds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类time_duration
的用法示例。
在下文中一共展示了time_duration::total_seconds方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _f_utc_difference
void BuiltIns::_f_utc_difference(Context* context) {
/* arguments: utc_difference
returnvalue: <T_INTEGER>
description: Returns the difference of local time and UTC time
(timezone and DST-adjusted) in seconds. (UTC + difference = localtime)
notes: May be negative.
*/
pushInteger(TZoffset.total_seconds());
}
示例2: sleep
/*!
\fn CPlayloop::sleep(int duration)
*/
int CPlayloop::sleep(time_duration duration)
{
int retval = 0;
if( !duration.is_negative() )
{
struct timespec ts_to_sleep, ts_remaining;
ts_to_sleep.tv_sec = duration.total_seconds();
ts_to_sleep.tv_nsec = duration.fractional_seconds();
//boost::date_time::time_resolutions
if (time_duration::resolution() == boost::date_time::micro) {
ts_to_sleep.tv_nsec *= 1000;
}
int retval = nanosleep( &ts_to_sleep, &ts_remaining);
if(retval != 0)
cerr << "nanosleep returned early due to a signal!" << endl;
}
return retval;
}
示例3: to_minutes
int User::to_minutes(time_duration duration)
{
return duration.total_seconds() / 60;
}
示例4: localTime
int64_t localTime() {
static const ptime epoch(date(1970, 1, 1));
const time_duration diff = second_clock::local_time() - epoch;
return diff.total_seconds();
}
示例5: epoch
int64_t str2time(const string& str) {
static const ptime epoch(date(1970, 1, 1));
const ptime string_time = from_iso_string(str);
const time_duration diff = string_time - epoch;
return diff.total_seconds();
}