A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://morganstanley.github.io/modern-cpp-kafka/doxygen/Timestamp_8h_source.html below:

Modern C++ Kafka API: /home/runner/work/modern-cpp-kafka/modern-cpp-kafka/include/kafka/Timestamp.h Source File

3 #include <kafka/Project.h> 5 #include <librdkafka/rdkafka.h> 22  using

Value = std::int64_t;

24  enum class

Type { NotAvailable, CreateTime, LogAppendTime };

39  static

Type 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  operator

std::chrono::time_point<std::chrono::system_clock>() const

47  return

std::chrono::time_point<std::chrono::system_clock>(std::chrono::milliseconds(

msSinceEpoch

));

54  case

Type::CreateTime:

56  case

Type::LogAppendTime:

57  return "LogAppendTime"

;

59

assert(t == Type::NotAvailable);

64  static

std::string

toString

(Value v)

66  auto

ms = std::chrono::milliseconds(v);

67  auto

timepoint = std::chrono::time_point<std::chrono::system_clock>(ms);

68  const

std::time_t time = std::chrono::system_clock::to_time_t(timepoint);

69

std::ostringstream oss;

72

oss << std::put_time(localtime_r(&time, &tmBuf),

"%F %T"

) <<

"."

<< std::setfill(

'0'

) << std::setw(3) << (v % 1000);

74

localtime_s(&tmBuf, &time);

75

oss << std::put_time(&tmBuf,

"%F %T"

) <<

"."

<< std::setfill(

'0'

) << std::setw(3) << (v % 1000);

87  return

typeString.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