Chromium Code Reviews| 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 der::GeneralizedTime EncodeTimeAsGeneralizedTime(const base::Time& time) { | |
| 13 base::Time::Exploded exploded; | |
| 14 time.UTCExplode(&exploded); | |
|
Ryan Sleevi
2016/07/01 00:49:53
DESIGN: Check HasValidValues()?
API suggestion:
b
dadrian
2016/07/01 17:13:43
UTCExplode is void...what error condition are you
Ryan Sleevi
2016/07/01 17:58:07
time.UTCExplode(&exploded);
if (!exploded.HasValid
dadrian
2016/07/01 18:41:11
Ah. Done. Will this fix the Windows case / thought
| |
| 15 | |
| 16 der::GeneralizedTime result; | |
| 17 result.year = exploded.year; | |
| 18 result.month = exploded.month; | |
| 19 result.day = exploded.day_of_month; | |
| 20 result.hours = exploded.hour; | |
| 21 result.minutes = exploded.minute; | |
| 22 result.seconds = exploded.second; | |
| 23 return result; | |
| 24 } | |
| 25 | |
| 26 } // namespace der | |
| 27 | |
| 28 } // namespace net | |
| OLD | NEW |