| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2015 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 #include "base/time/time.h" |
| 6 #include "net/der/encode_values.h" |
| 7 |
| 8 namespace net { |
| 9 |
| 10 namespace der { |
| 11 |
| 12 bool EncodeTimeAsGeneralizedTime(const base::Time& time, |
| 13 der::GeneralizedTime* generalized_time) { |
| 14 base::Time::Exploded exploded; |
| 15 time.UTCExplode(&exploded); |
| 16 if (!exploded.HasValidValues()) |
| 17 return false; |
| 18 |
| 19 generalized_time->year = exploded.year; |
| 20 generalized_time->month = exploded.month; |
| 21 generalized_time->day = exploded.day_of_month; |
| 22 generalized_time->hours = exploded.hour; |
| 23 generalized_time->minutes = exploded.minute; |
| 24 generalized_time->seconds = exploded.second; |
| 25 return true; |
| 26 } |
| 27 |
| 28 } // namespace der |
| 29 |
| 30 } // namespace net |
| OLD | NEW |