sapling/common/fb303/cpp/FacebookBase2.h
Rob Sherwood ed47573b67 Fix open source aliveSince() implementation
Summary:
aliveSince() has a misleading name and I misunderstood.
The correct implementation just returns the timestamp of when
the process started as opposed to my understanding (the number
of seconds since the process started).

Reviewed By: linhbui

Differential Revision: D6789987

fbshipit-source-id: db60bf00f6b07e31d91dfc8ed06d1c1cbe172a64
2018-01-25 10:22:07 -08:00

38 lines
850 B
C++

/*
* Copyright (c) 2004-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
#pragma once
#include <time.h>
#include <common/fb303/if/gen-cpp2/FacebookService.h>
namespace folly {
class EventBaseManager;
}
namespace facebook { namespace fb303 {
class FacebookBase2 : virtual public cpp2::FacebookServiceSvIf {
time_t startTime;
public:
explicit FacebookBase2(const char*) {
startTime = time(NULL);
}
void setEventBaseManager(folly::EventBaseManager*) {}
int64_t aliveSince() override {
// crude implementation because QsfpCache depends on it
return (uint64_t) startTime;
}
};
}}