summaryrefslogtreecommitdiff
path: root/chromium/components/feature_engagement/internal/time_provider.h
blob: ad316ded39c01b276eaf030cc3b44657b4577647 (plain)
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
30
31
32
33
34
35
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_FEATURE_ENGAGEMENT_INTERNAL_TIME_PROVIDER_H_
#define COMPONENTS_FEATURE_ENGAGEMENT_INTERNAL_TIME_PROVIDER_H_

#include <stdint.h>

#include "base/macros.h"
#include "base/time/time.h"

namespace feature_engagement {

// A TimeProvider provides functionality related to time.
class TimeProvider {
 public:
  TimeProvider(const TimeProvider&) = delete;
  TimeProvider& operator=(const TimeProvider&) = delete;

  virtual ~TimeProvider() = default;

  // Returns the number of days since epoch (1970-01-01) in the local timezone.
  virtual uint32_t GetCurrentDay() const = 0;

  // Returns the current time.
  virtual base::Time Now() const = 0;

 protected:
  TimeProvider() = default;
};

}  // namespace feature_engagement

#endif  // COMPONENTS_FEATURE_ENGAGEMENT_INTERNAL_TIME_PROVIDER_H_