• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2019 The Chromium 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 CAST_COMMON_CERTIFICATE_TYPES_H_
6 #define CAST_COMMON_CERTIFICATE_TYPES_H_
7 
8 #include <stdint.h>
9 
10 #include <chrono>
11 
12 namespace openscreen {
13 namespace cast {
14 
15 struct ConstDataSpan {
16   const uint8_t* data;
17   uint32_t length;
18 };
19 
20 struct DateTime {
21   uint16_t year;
22   uint8_t month;
23   uint8_t day;
24   uint8_t hour;
25   uint8_t minute;
26   uint8_t second;
27 };
28 
29 bool operator<(const DateTime& a, const DateTime& b);
30 bool operator>(const DateTime& a, const DateTime& b);
31 bool DateTimeFromSeconds(uint64_t seconds, DateTime* time);
32 
33 // |time| is assumed to be valid.
34 std::chrono::seconds DateTimeToSeconds(const DateTime& time);
35 
36 }  // namespace cast
37 }  // namespace openscreen
38 
39 #endif  // CAST_COMMON_CERTIFICATE_TYPES_H_
40