blob: 94f4a8f09bbb0857f1731f85a6cb243c659d5051 [file] [log] [blame]
Alex Deymoaea4c1c2015-08-19 20:24:43 -07001//
2// Copyright (C) 2014 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
Gilad Arnold78a78112014-03-13 14:58:06 -070016
Gilad Arnold48415f12014-06-27 07:10:58 -070017#ifndef UPDATE_ENGINE_UPDATE_MANAGER_TIME_PROVIDER_H_
18#define UPDATE_ENGINE_UPDATE_MANAGER_TIME_PROVIDER_H_
Gilad Arnold78a78112014-03-13 14:58:06 -070019
Alex Vakulenko75039d72014-03-25 12:36:28 -070020#include <base/time/time.h>
Gilad Arnold78a78112014-03-13 14:58:06 -070021
Alex Deymo63784a52014-05-28 10:46:14 -070022#include "update_engine/update_manager/provider.h"
23#include "update_engine/update_manager/variable.h"
Gilad Arnold78a78112014-03-13 14:58:06 -070024
Alex Deymo63784a52014-05-28 10:46:14 -070025namespace chromeos_update_manager {
Gilad Arnold78a78112014-03-13 14:58:06 -070026
27// Provider for time related information.
28class TimeProvider : public Provider {
29 public:
Alex Deymo610277e2014-11-11 21:18:11 -080030 ~TimeProvider() override {}
David Zeuthen21716e22014-04-23 15:42:05 -070031
Gilad Arnold78a78112014-03-13 14:58:06 -070032 // Returns the current date. The time of day component will be zero.
David Zeuthen21716e22014-04-23 15:42:05 -070033 virtual Variable<base::Time>* var_curr_date() = 0;
Gilad Arnold78a78112014-03-13 14:58:06 -070034
35 // Returns the current hour (0 to 23) in local time. The type is int to keep
36 // consistent with base::Time.
David Zeuthen21716e22014-04-23 15:42:05 -070037 virtual Variable<int>* var_curr_hour() = 0;
Gilad Arnold78a78112014-03-13 14:58:06 -070038
Adolfo Victoria96143502018-06-13 18:44:49 -070039 // Returns the current minutes (0 to 60) in local time.
40 virtual Variable<int>* var_curr_minute() = 0;
41
Gilad Arnold78a78112014-03-13 14:58:06 -070042 protected:
43 TimeProvider() {}
44
Gilad Arnold78a78112014-03-13 14:58:06 -070045 private:
Gilad Arnold78a78112014-03-13 14:58:06 -070046 DISALLOW_COPY_AND_ASSIGN(TimeProvider);
47};
48
Alex Deymo63784a52014-05-28 10:46:14 -070049} // namespace chromeos_update_manager
Gilad Arnold78a78112014-03-13 14:58:06 -070050
Gilad Arnold48415f12014-06-27 07:10:58 -070051#endif // UPDATE_ENGINE_UPDATE_MANAGER_TIME_PROVIDER_H_