Alexander Afanasyev | 1e0a077 | 2014-01-28 20:07:07 -0800 | [diff] [blame] | 1 | /** |
| 2 | * Copyright (C) 2013 Regents of the University of California. |
| 3 | * See COPYING for copyright and distribution information. |
| 4 | */ |
| 5 | |
| 6 | #include <boost/test/unit_test.hpp> |
| 7 | |
Alexander Afanasyev | 09c613f | 2014-01-29 00:23:58 -0800 | [diff] [blame] | 8 | #include "util/time.hpp" |
Alexander Afanasyev | 1e0a077 | 2014-01-28 20:07:07 -0800 | [diff] [blame] | 9 | |
Alexander Afanasyev | 0abb2da | 2014-01-30 18:07:57 -0800 | [diff] [blame^] | 10 | namespace ndn { |
| 11 | |
Alexander Afanasyev | 1e0a077 | 2014-01-28 20:07:07 -0800 | [diff] [blame] | 12 | BOOST_AUTO_TEST_SUITE(TestTime) |
| 13 | |
| 14 | BOOST_AUTO_TEST_CASE (Simple) |
| 15 | { |
Alexander Afanasyev | 0abb2da | 2014-01-30 18:07:57 -0800 | [diff] [blame^] | 16 | MillisecondsSince1970 value = getNowMilliseconds(); |
Alexander Afanasyev | 1e0a077 | 2014-01-28 20:07:07 -0800 | [diff] [blame] | 17 | BOOST_CHECK_GT(value, 1390966967032); |
| 18 | |
Alexander Afanasyev | 0abb2da | 2014-01-30 18:07:57 -0800 | [diff] [blame^] | 19 | BOOST_CHECK_EQUAL(toIsoString(1390966967032), "20140129T034247.032000"); |
| 20 | BOOST_CHECK_EQUAL(fromIsoString("20140129T034247.032000"), 1390966967032); |
Alexander Afanasyev | 1e0a077 | 2014-01-28 20:07:07 -0800 | [diff] [blame] | 21 | |
Alexander Afanasyev | 0abb2da | 2014-01-30 18:07:57 -0800 | [diff] [blame^] | 22 | BOOST_CHECK_EQUAL(fromIsoString("20140129T034247.032000Z"), 1390966967032); |
Alexander Afanasyev | 1e0a077 | 2014-01-28 20:07:07 -0800 | [diff] [blame] | 23 | } |
| 24 | |
| 25 | BOOST_AUTO_TEST_SUITE_END() |
Alexander Afanasyev | 0abb2da | 2014-01-30 18:07:57 -0800 | [diff] [blame^] | 26 | |
| 27 | } // namespace ndn |