blob: a1280942ad7e11ca24e5073b5f26fecb05e00c5b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "clock.h"
namespace vespalib {
class Doom {
public:
Doom(const Clock &clock, steady_time doom)
: Doom(clock, doom, doom, false)
{}
Doom(const Clock &clock, steady_time softDoom,
steady_time hardDoom, bool explicitSoftDoom);
bool soft_doom() const { return (_clock.getTimeNSAssumeRunning() > _softDoom); }
bool hard_doom() const { return (_clock.getTimeNSAssumeRunning() > _hardDoom); }
duration soft_left() const { return _softDoom - _clock.getTimeNS(); }
duration hard_left() const { return _hardDoom - _clock.getTimeNS(); }
bool isExplicitSoftDoom() const { return _isExplicitSoftDoom; }
private:
const Clock &_clock;
steady_time _softDoom;
steady_time _hardDoom;
bool _isExplicitSoftDoom;
};
}
|