blob: 3c217d35860a8f74fe47c7b17994ef0b3781c080 (
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
|
// 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 "base/time/time.h"
#include "net/der/encode_values.h"
namespace net {
namespace der {
bool EncodeTimeAsGeneralizedTime(const base::Time& time,
der::GeneralizedTime* generalized_time) {
base::Time::Exploded exploded;
time.UTCExplode(&exploded);
if (!exploded.HasValidValues())
return false;
generalized_time->year = exploded.year;
generalized_time->month = exploded.month;
generalized_time->day = exploded.day_of_month;
generalized_time->hours = exploded.hour;
generalized_time->minutes = exploded.minute;
generalized_time->seconds = exploded.second;
return true;
}
} // namespace der
} // namespace net
|