本文整理汇总了C++中TimeZone::civilian方法的典型用法代码示例。如果您正苦于以下问题:C++ TimeZone::civilian方法的具体用法?C++ TimeZone::civilian怎么用?C++ TimeZone::civilian使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimeZone
的用法示例。
在下文中一共展示了TimeZone::civilian方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: civilian
const char* TimeStamp::civilian(const LocalTime& lt) {
TimeZone zone;
const char* timezone = zone.civilian(lt.getOffset());
char effective[4];
std::strncpy(effective, timezone, sizeof(effective));
if (lt.getDst() && (3 <= std::strlen(effective))) {
effective[1] = 'D';
}
::snprintf(this->buffer, sizeof(this->buffer),
"%04llu-%02u-%02u %02u:%02u:%02u %s",
lt.getYear(), lt.getMonth(), lt.getDay(),
lt.getHour(), lt.getMinute(), lt.getSecond(),
effective);
this->buffer[sizeof(this->buffer) - 1] = '\0';
assert(std::strlen(this->buffer) < sizeof(this->buffer));
return this->buffer;
}
示例2: formal
const char* TimeStamp::formal(const LocalTime& lt) {
const Date& date = lt.getDate();
const Time& time = lt.getTime();
TimeZone zone;
const char* timezone = zone.civilian(lt.getOffset());
char effective[4];
std::strncpy(effective, timezone, sizeof(effective));
if (lt.getDst() && (3 <= std::strlen(effective))) {
effective[1] = 'D';
}
uint8_t twelve;
const char* meridiem = time.meridiemToString(time.oclock(twelve));
::snprintf(this->buffer, sizeof(this->buffer),
"%s, %s %u, %04llu, %u:%02u %s %s",
date.weekdayToString(), date.monthToString(), lt.getDay(), lt.getYear(),
twelve, lt.getMinute(), meridiem,
effective);
this->buffer[sizeof(this->buffer) - 1] = '\0';
assert(std::strlen(this->buffer) < sizeof(this->buffer));
return this->buffer;
}