本文整理汇总了C++中DateComponents::setMillisecondsSinceMidnight方法的典型用法代码示例。如果您正苦于以下问题:C++ DateComponents::setMillisecondsSinceMidnight方法的具体用法?C++ DateComponents::setMillisecondsSinceMidnight怎么用?C++ DateComponents::setMillisecondsSinceMidnight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateComponents
的用法示例。
在下文中一共展示了DateComponents::setMillisecondsSinceMidnight方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: defaultValueForStepUp
Decimal TimeInputType::defaultValueForStepUp() const {
DateComponents date;
date.setMillisecondsSinceMidnight(convertToLocalTime(currentTimeMS()));
double milliseconds = date.millisecondsSinceEpoch();
DCHECK(std::isfinite(milliseconds));
return Decimal::fromDouble(milliseconds);
}
示例2: defaultValueForStepUp
Decimal TimeInputType::defaultValueForStepUp() const
{
double current = currentTimeMS();
int offset = calculateLocalTimeOffset(current).offset / msPerMinute;
current += offset * msPerMinute;
DateComponents date;
date.setMillisecondsSinceMidnight(current);
double milliseconds = date.millisecondsSinceEpoch();
ASSERT(std::isfinite(milliseconds));
return Decimal::fromDouble(milliseconds);
}
示例3: defaultValueForStepUp
Decimal TimeInputType::defaultValueForStepUp() const
{
double current = currentTimeMS();
double utcOffset = calculateUTCOffset();
double dstOffset = calculateDSTOffset(current, utcOffset);
int offset = static_cast<int>((utcOffset + dstOffset) / msPerMinute);
current += offset * msPerMinute;
DateComponents date;
date.setMillisecondsSinceMidnight(current);
double milliseconds = date.millisecondsSinceEpoch();
ASSERT(std::isfinite(milliseconds));
return Decimal::fromDouble(milliseconds);
}
示例4: valueToDateTimeString
static String valueToDateTimeString(double value, AtomicString type)
{
DateComponents components;
if (type == InputTypeNames::date)
components.setMillisecondsSinceEpochForDate(value);
else if (type == InputTypeNames::datetime_local)
components.setMillisecondsSinceEpochForDateTimeLocal(value);
else if (type == InputTypeNames::month)
components.setMonthsSinceEpoch(value);
else if (type == InputTypeNames::time)
components.setMillisecondsSinceMidnight(value);
else if (type == InputTypeNames::week)
components.setMillisecondsSinceEpochForWeek(value);
else
ASSERT_NOT_REACHED();
return components.type() == DateComponents::Invalid ? String() : components.toString();
}
示例5: timeComponents
DateComponents timeComponents(int hour, int minute, int second, int millisecond)
{
DateComponents date;
date.setMillisecondsSinceMidnight(hour * msPerHour + minute * msPerMinute + second * msPerSecond + millisecond);
return date;
}