summaryrefslogtreecommitdiff
path: root/chromium/cc/proto/base_conversions.cc
blob: 119903b2856db9ce8a1b68ab16fb8dd600357f21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Copyright 2016 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.

#include "cc/proto/base_conversions.h"

namespace base {
class TimeDelta;
}

namespace cc {

int64_t TimeTicksToProto(base::TimeTicks ticks) {
  base::TimeDelta diff = ticks - base::TimeTicks::UnixEpoch();
  return diff.InMicroseconds();
}

CC_EXPORT base::TimeTicks ProtoToTimeTicks(int64_t ticks) {
  base::TimeDelta diff = base::TimeDelta::FromMicroseconds(ticks);
  return base::TimeTicks::UnixEpoch() + diff;
}

}  // namespace cc