MCPcopy Create free account
hub / github.com/apple/foundationdb / epochsToGMTString

Function epochsToGMTString

flow/Platform.actor.cpp:1922–1934  ·  view source on GitHub ↗

Outputs a GMT time string for the given epoch seconds, which looks like 2013-04-28 20:57:01.000 +0000

Source from the content-addressed store, hash-verified

1920// Outputs a GMT time string for the given epoch seconds, which looks like
1921// 2013-04-28 20:57:01.000 +0000
1922std::string epochsToGMTString(double epochs) {
1923 auto time = (time_t)epochs;
1924
1925 char buff[50];
1926 auto size = strftime(buff, 50, "%Y-%m-%d %H:%M:%S", gmtime(&time));
1927 std::string timeString = std::string(std::begin(buff), std::begin(buff) + size);
1928
1929 // Add fractional seconds and GMT timezone.
1930 double integerPart;
1931 timeString += format(".%03.3d +0000", (int)(1000 * modf(epochs, &integerPart)));
1932
1933 return timeString;
1934}
1935
1936void setMemoryQuota(size_t limit) {
1937 if (limit == 0) {

Callers 3

toJSONMethod · 0.85
toJSONMethod · 0.85

Calls 3

gmtimeFunction · 0.85
beginFunction · 0.85
formatFunction · 0.70

Tested by

no test coverage detected