Skip to content

Commit a97a219

Browse files
committed
Ignore microseconds per the spec
1 parent ab3be7d commit a97a219

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/Authentication/Timestamp.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
*/
1919
class Timestamp
2020
{
21+
const FORMAT = 'Ymd\TH:i:sO';
22+
2123
/**
2224
* @var \DateTime Signing Timestamp
2325
*/
@@ -69,6 +71,6 @@ public function setValidFor($interval)
6971
*/
7072
public function __toString()
7173
{
72-
return $this->timestamp->format('Ymd\TH:i:s.uO');
74+
return $this->timestamp->format(static::FORMAT);
7375
}
7476
}

tests/Authentication/TimestampTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ public function testTimestampFormat()
2828
{
2929
$timestamp = new \Akamai\Open\EdgeGrid\Authentication\Timestamp();
3030

31-
$check = \DateTime::createFromFormat('Ymd\TH:i:s.uO', (string) $timestamp, new \DateTimeZone('UTC'));
32-
$this->assertEquals($check, \PHPUnit_Framework_Assert::readAttribute($timestamp, 'timestamp'));
31+
$check = \DateTime::createFromFormat('Ymd\TH:i:sO', (string) $timestamp, new \DateTimeZone('UTC'));
32+
$this->assertEquals($check->format(\Akamai\Open\EdgeGrid\Authentication\Timestamp::FORMAT), (string) $timestamp);
3333
}
3434

3535

0 commit comments

Comments
 (0)