Value = std::int64_t;
24 enum classType { NotAvailable, CreateTime, LogAppendTime };
39 staticType convertType(rd_kafka_timestamp_type_t tstype)
41 return(tstype == RD_KAFKA_TIMESTAMP_CREATE_TIME) ? Type::CreateTime :
42(tstype == RD_KAFKA_TIMESTAMP_LOG_APPEND_TIME ? Type::LogAppendTime : Type::NotAvailable);
45 operatorstd::chrono::time_point<std::chrono::system_clock>() const
47 returnstd::chrono::time_point<std::chrono::system_clock>(std::chrono::milliseconds(
msSinceEpoch));
54 caseType::CreateTime:
56 caseType::LogAppendTime:
57 return "LogAppendTime";
59assert(t == Type::NotAvailable);
64 staticstd::string
toString(Value v)
66 automs = std::chrono::milliseconds(v);
67 autotimepoint = std::chrono::time_point<std::chrono::system_clock>(ms);
68 conststd::time_t time = std::chrono::system_clock::to_time_t(timepoint);
69std::ostringstream oss;
72oss << std::put_time(localtime_r(&time, &tmBuf),
"%F %T") <<
"."<< std::setfill(
'0') << std::setw(3) << (v % 1000);
74localtime_s(&tmBuf, &time);
75oss << std::put_time(&tmBuf,
"%F %T") <<
"."<< std::setfill(
'0') << std::setw(3) << (v % 1000);
87 returntypeString.empty() ? timeString : (typeString +
"["+ timeString +
"]");
The time point together with the type.
Definition: Timestamp.h:21
Type type
The type shows what the msSinceEpoch means (CreateTime or LogAppendTime).
Definition: Timestamp.h:34
std::string toString() const
Obtains explanatory string.
Definition: Timestamp.h:83
Value msSinceEpoch
The milliseconds since epoch.
Definition: Timestamp.h:29
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4