blob: 84cbf1d1040a44d84d0578f3e2ef25058bc320ce [file] [log] [blame]
Gilad Arnold78a78112014-03-13 14:58:06 -07001// Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_REAL_TIME_PROVIDER_H_
6#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_REAL_TIME_PROVIDER_H_
7
Alex Vakulenko75039d72014-03-25 12:36:28 -07008#include <base/time/time.h>
Gilad Arnold78a78112014-03-13 14:58:06 -07009
10#include "update_engine/clock_interface.h"
11#include "update_engine/policy_manager/time_provider.h"
12
13namespace chromeos_policy_manager {
14
15// TimeProvider concrete implementation.
16class RealTimeProvider : public TimeProvider {
17 public:
18 RealTimeProvider(chromeos_update_engine::ClockInterface* clock)
19 : clock_(clock) {}
20
Alex Deymo42c30c32014-04-24 18:41:18 -070021 // Initializes the provider and returns whether it succeeded.
22 bool Init();
23
David Zeuthen21716e22014-04-23 15:42:05 -070024 virtual Variable<base::Time>* var_curr_date() override {
25 return var_curr_date_.get();
26 }
27
28 virtual Variable<int>* var_curr_hour() override {
29 return var_curr_hour_.get();
30 }
Gilad Arnold78a78112014-03-13 14:58:06 -070031
32 private:
David Zeuthen21716e22014-04-23 15:42:05 -070033 // A clock abstraction (fakeable).
Gilad Arnold78a78112014-03-13 14:58:06 -070034 chromeos_update_engine::ClockInterface* const clock_;
35
David Zeuthen21716e22014-04-23 15:42:05 -070036 scoped_ptr<Variable<base::Time>> var_curr_date_;
37 scoped_ptr<Variable<int>> var_curr_hour_;
38
Gilad Arnold78a78112014-03-13 14:58:06 -070039 DISALLOW_COPY_AND_ASSIGN(RealTimeProvider);
40};
41
42} // namespace chromeos_policy_manager
43
44#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_REAL_TIME_PROVIDER_H_