mukesh agrawal | 2e84b4a | 2014-04-24 15:42:47 -0700 | [diff] [blame] | 1 | // Copyright (c) 2014 The Chromium OS 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 "shill/shill_time.h" |
| 6 | |
| 7 | #include <time.h> |
| 8 | |
| 9 | #include <gtest/gtest.h> |
| 10 | |
| 11 | using std::string; |
| 12 | using testing::Test; |
| 13 | |
| 14 | namespace shill { |
| 15 | |
| 16 | class TimeTest : public Test { |
| 17 | }; |
| 18 | |
| 19 | TEST_F(TimeTest, FormatTime) { |
| 20 | const time_t kEpochStart = 0; |
| 21 | const char kEpochStartString[] = "1970-01-01T00:00:00.000000+0000"; |
| 22 | struct tm epoch_start_tm; |
| 23 | gmtime_r(&kEpochStart, &epoch_start_tm); |
| 24 | EXPECT_EQ(kEpochStartString, Time::FormatTime(epoch_start_tm, 0)); |
| 25 | } |
| 26 | |
| 27 | } // namespace shill |