Chromium Code Reviews| Index: net/der/encode_values.cc |
| diff --git a/net/der/encode_values.cc b/net/der/encode_values.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1fe190c93cc3e9b960f570d8fadc38d6217fd34b |
| --- /dev/null |
| +++ b/net/der/encode_values.cc |
| @@ -0,0 +1,28 @@ |
| +// Copyright 2015 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 { |
| + |
| +der::GeneralizedTime EncodeTimeAsGeneralizedTime(const base::Time& time) { |
| + base::Time::Exploded exploded; |
| + 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
|
| + |
| + der::GeneralizedTime result; |
| + result.year = exploded.year; |
| + result.month = exploded.month; |
| + result.day = exploded.day_of_month; |
| + result.hours = exploded.hour; |
| + result.minutes = exploded.minute; |
| + result.seconds = exploded.second; |
| + return result; |
| +} |
| + |
| +} // namespace der |
| + |
| +} // namespace net |