本文整理汇总了C++中DateComponents::millisecondsSinceEpoch方法的典型用法代码示例。如果您正苦于以下问题:C++ DateComponents::millisecondsSinceEpoch方法的具体用法?C++ DateComponents::millisecondsSinceEpoch怎么用?C++ DateComponents::millisecondsSinceEpoch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateComponents
的用法示例。
在下文中一共展示了DateComponents::millisecondsSinceEpoch方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseToDouble
double BaseDateAndTimeInputType::parseToDouble(const String& src, double defaultValue) const
{
DateComponents date;
if (!parseToDateComponents(src, &date))
return defaultValue;
double msec = date.millisecondsSinceEpoch();
ASSERT(isfinite(msec));
return msec;
}
示例2: parseToNumber
Decimal BaseDateAndTimeInputType::parseToNumber(const String& source, const Decimal& defaultValue) const
{
DateComponents date;
if (!parseToDateComponents(source, &date))
return defaultValue;
double msec = date.millisecondsSinceEpoch();
ASSERT(std::isfinite(msec));
return Decimal::fromDouble(msec);
}
示例3: valueAsDate
double MonthInputType::valueAsDate() const
{
DateComponents date;
if (!parseToDateComponents(element()->value(), &date))
return DateComponents::invalidMilliseconds();
double msec = date.millisecondsSinceEpoch();
ASSERT(std::isfinite(msec));
return msec;
}
示例4: 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);
}
示例5: 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);
}
示例6: formatLocalizedDate
String ICULocale::formatLocalizedDate(const DateComponents& dateComponents)
{
if (!initializeShortDateFormat())
return String();
double input = dateComponents.millisecondsSinceEpoch();
UErrorCode status = U_ZERO_ERROR;
int32_t length = udat_format(m_shortDateFormat, input, 0, 0, 0, &status);
if (status != U_BUFFER_OVERFLOW_ERROR)
return String();
Vector<UChar> buffer(length);
status = U_ZERO_ERROR;
udat_format(m_shortDateFormat, input, buffer.data(), length, 0, &status);
if (U_FAILURE(status))
return String();
return String::adopt(buffer);
}