function data_parse_digits()
 {
     return [[0, 0, "1970-01-01T00:00:00Z"], [0, 0, "1970-01-01T00:00:00Z"], [0, 0, "1970-01-01T00:00:00.0Z"], [0, 0, "1970-01-01T00:00:00.000Z"], [0, 0, "1970-01-01T00:00:00.000000000Z"], [-1, 0, "1969-12-31T23:59:59Z"], [1, 0, "1970-01-01T00:00:01Z"], [60, 0, "1970-01-01T00:01:00Z"], [3600, 0, "1970-01-01T01:00:00Z"], [86400, 0, "1970-01-02T00:00:00Z"], [182, 234000000, "1970-01-01T00:03:02.234Z"], [182, 234000000, "1970-01-01T00:03:02.2340Z"], [182, 234000000, "1970-01-01T00:03:02.23400Z"], [182, 234000000, "1970-01-01T00:03:02.234000Z"], [182, 234000000, "1970-01-01T00:03:02.234000000Z"], [(23 * 60 + 59) * 60 + 59, 123456789, "1970-01-01T23:59:59.123456789Z"], [Instant::MAX()->getEpochSecond(), 999999999, "+1000000000-12-31T23:59:59.999999999Z"], [Instant::MIN()->getEpochSecond(), 0, "-1000000000-01-01T00:00:00.000000000Z"]];
 }
 /**
  * @expectedException \Celest\DateTimeException
  */
 public function test_factory_ofInstant_instantTooBig()
 {
     LocalDateTime::ofInstant(Instant::MAX(), self::OFFSET_PONE());
 }
예제 #3
0
 public function test_factory_ofInstant_maxYear()
 {
     $test = OffsetTime::ofInstant(Instant::MAX(), ZoneOffset::UTC());
     $this->assertEquals($test->getHour(), 23);
     $this->assertEquals($test->getMinute(), 59);
     $this->assertEquals($test->getSecond(), 59);
     $this->assertEquals($test->getNano(), 999999999);
 }
예제 #4
0
 public function test_now_Clock_max()
 {
     $clock = Clock::fixed(Instant::MAX(), ZoneOffset::UTC());
     $test = LocalTime::nowOf($clock);
     $this->assertEquals($test->getHour(), 23);
     $this->assertEquals($test->getMinute(), 59);
     $this->assertEquals($test->getSecond(), 59);
     $this->assertEquals($test->getNano(), 999999999);
 }
예제 #5
0
 function data_toString()
 {
     return [[Instant::ofEpochSecond(65, 567), "1970-01-01T00:01:05.000000567Z"], [Instant::ofEpochSecond(65, 560), "1970-01-01T00:01:05.000000560Z"], [Instant::ofEpochSecond(65, 560000), "1970-01-01T00:01:05.000560Z"], [Instant::ofEpochSecond(65, 560000000), "1970-01-01T00:01:05.560Z"], [Instant::ofEpochSecond(1, 0), "1970-01-01T00:00:01Z"], [Instant::ofEpochSecond(60, 0), "1970-01-01T00:01:00Z"], [Instant::ofEpochSecond(3600, 0), "1970-01-01T01:00:00Z"], [Instant::ofEpochSecond(-1, 0), "1969-12-31T23:59:59Z"], [LocalDateTime::of(0, 1, 2, 0, 0)->toInstant(ZoneOffset::UTC()), "0000-01-02T00:00:00Z"], [LocalDateTime::of(0, 1, 1, 12, 30)->toInstant(ZoneOffset::UTC()), "0000-01-01T12:30:00Z"], [LocalDateTime::of(0, 1, 1, 0, 0, 0, 1)->toInstant(ZoneOffset::UTC()), "0000-01-01T00:00:00.000000001Z"], [LocalDateTime::of(0, 1, 1, 0, 0)->toInstant(ZoneOffset::UTC()), "0000-01-01T00:00:00Z"], [LocalDateTime::of(-1, 12, 31, 23, 59, 59, 999999999)->toInstant(ZoneOffset::UTC()), "-0001-12-31T23:59:59.999999999Z"], [LocalDateTime::of(-1, 12, 31, 12, 30)->toInstant(ZoneOffset::UTC()), "-0001-12-31T12:30:00Z"], [LocalDateTime::of(-1, 12, 30, 12, 30)->toInstant(ZoneOffset::UTC()), "-0001-12-30T12:30:00Z"], [LocalDateTime::of(-9999, 1, 2, 12, 30)->toInstant(ZoneOffset::UTC()), "-9999-01-02T12:30:00Z"], [LocalDateTime::of(-9999, 1, 1, 12, 30)->toInstant(ZoneOffset::UTC()), "-9999-01-01T12:30:00Z"], [LocalDateTime::of(-9999, 1, 1, 0, 0)->toInstant(ZoneOffset::UTC()), "-9999-01-01T00:00:00Z"], [LocalDateTime::of(-10000, 12, 31, 23, 59, 59, 999999999)->toInstant(ZoneOffset::UTC()), "-10000-12-31T23:59:59.999999999Z"], [LocalDateTime::of(-10000, 12, 31, 12, 30)->toInstant(ZoneOffset::UTC()), "-10000-12-31T12:30:00Z"], [LocalDateTime::of(-10000, 12, 30, 12, 30)->toInstant(ZoneOffset::UTC()), "-10000-12-30T12:30:00Z"], [LocalDateTime::of(-15000, 12, 31, 12, 30)->toInstant(ZoneOffset::UTC()), "-15000-12-31T12:30:00Z"], [LocalDateTime::of(-19999, 1, 2, 12, 30)->toInstant(ZoneOffset::UTC()), "-19999-01-02T12:30:00Z"], [LocalDateTime::of(-19999, 1, 1, 12, 30)->toInstant(ZoneOffset::UTC()), "-19999-01-01T12:30:00Z"], [LocalDateTime::of(-19999, 1, 1, 0, 0)->toInstant(ZoneOffset::UTC()), "-19999-01-01T00:00:00Z"], [LocalDateTime::of(-20000, 12, 31, 23, 59, 59, 999999999)->toInstant(ZoneOffset::UTC()), "-20000-12-31T23:59:59.999999999Z"], [LocalDateTime::of(-20000, 12, 31, 12, 30)->toInstant(ZoneOffset::UTC()), "-20000-12-31T12:30:00Z"], [LocalDateTime::of(-20000, 12, 30, 12, 30)->toInstant(ZoneOffset::UTC()), "-20000-12-30T12:30:00Z"], [LocalDateTime::of(-25000, 12, 31, 12, 30)->toInstant(ZoneOffset::UTC()), "-25000-12-31T12:30:00Z"], [LocalDateTime::of(9999, 12, 30, 12, 30)->toInstant(ZoneOffset::UTC()), "9999-12-30T12:30:00Z"], [LocalDateTime::of(9999, 12, 31, 12, 30)->toInstant(ZoneOffset::UTC()), "9999-12-31T12:30:00Z"], [LocalDateTime::of(9999, 12, 31, 23, 59, 59, 999999999)->toInstant(ZoneOffset::UTC()), "9999-12-31T23:59:59.999999999Z"], [LocalDateTime::of(10000, 1, 1, 0, 0)->toInstant(ZoneOffset::UTC()), "+10000-01-01T00:00:00Z"], [LocalDateTime::of(10000, 1, 1, 12, 30)->toInstant(ZoneOffset::UTC()), "+10000-01-01T12:30:00Z"], [LocalDateTime::of(10000, 1, 2, 12, 30)->toInstant(ZoneOffset::UTC()), "+10000-01-02T12:30:00Z"], [LocalDateTime::of(15000, 12, 31, 12, 30)->toInstant(ZoneOffset::UTC()), "+15000-12-31T12:30:00Z"], [LocalDateTime::of(19999, 12, 30, 12, 30)->toInstant(ZoneOffset::UTC()), "+19999-12-30T12:30:00Z"], [LocalDateTime::of(19999, 12, 31, 12, 30)->toInstant(ZoneOffset::UTC()), "+19999-12-31T12:30:00Z"], [LocalDateTime::of(19999, 12, 31, 23, 59, 59, 999999999)->toInstant(ZoneOffset::UTC()), "+19999-12-31T23:59:59.999999999Z"], [LocalDateTime::of(20000, 1, 1, 0, 0)->toInstant(ZoneOffset::UTC()), "+20000-01-01T00:00:00Z"], [LocalDateTime::of(20000, 1, 1, 12, 30)->toInstant(ZoneOffset::UTC()), "+20000-01-01T12:30:00Z"], [LocalDateTime::of(20000, 1, 2, 12, 30)->toInstant(ZoneOffset::UTC()), "+20000-01-02T12:30:00Z"], [LocalDateTime::of(25000, 12, 31, 12, 30)->toInstant(ZoneOffset::UTC()), "+25000-12-31T12:30:00Z"], [LocalDateTime::of(-999999999, 1, 1, 12, 30)->toInstant(ZoneOffset::UTC())->minus(1, CU::DAYS()), "-1000000000-12-31T12:30:00Z"], [LocalDateTime::of(999999999, 12, 31, 12, 30)->toInstant(ZoneOffset::UTC())->plus(1, CU::DAYS()), "+1000000000-01-01T12:30:00Z"], [Instant::MIN(), "-1000000000-01-01T00:00:00Z"], [Instant::MAX(), "+1000000000-12-31T23:59:59.999999999Z"]];
 }