File tree 2 files changed +10
-1
lines changed
src/Symfony/Component/Uid
2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -124,7 +124,7 @@ public static function timeToFloat(string $time): float
124
124
$ time = self ::add ($ time , self ::TIME_OFFSET_COM2 );
125
125
126
126
if ($ time >= self ::TIME_OFFSET_COM2 ) {
127
- $ time = -1 * self ::toBase ($ time ^ "\xff\xff\xff\xff\xff\xff\xff\xff" , self ::BASE10 );
127
+ $ time = -1 * ( self ::toBase ($ time ^ "\xff\xff\xff\xff\xff\xff\xff\xff" , self ::BASE10 ) + 1 );
128
128
} else {
129
129
$ time [0 ] = $ time [0 ] & "\x7F" ;
130
130
$ time = self ::toBase ($ time , self ::BASE10 );
Original file line number Diff line number Diff line change @@ -199,4 +199,13 @@ public function testFromStringOnExtendedClassReturnsStatic()
199
199
{
200
200
$ this ->assertInstanceOf (CustomUuid::class, CustomUuid::fromString (self ::A_UUID_V4 ));
201
201
}
202
+
203
+ public function testGetTime ()
204
+ {
205
+ $ this ->assertSame (103072857660.6847 , ((new UuidV1 ('ffffffff-ffff-1fff-a456-426655440000 ' ))->getTime ()));
206
+ $ this ->assertSame (0.0000001 , ((new UuidV1 ('13814001-1dd2-11b2-a456-426655440000 ' ))->getTime ()));
207
+ $ this ->assertSame (0.0 , (new UuidV1 ('13814000-1dd2-11b2-a456-426655440000 ' ))->getTime ());
208
+ $ this ->assertSame (-0.0000001 , (new UuidV1 ('13813fff-1dd2-11b2-a456-426655440000 ' ))->getTime ());
209
+ $ this ->assertSame (-12219292800.0 , ((new UuidV1 ('00000000-0000-1000-a456-426655440000 ' ))->getTime ()));
210
+ }
202
211
}
You can’t perform that action at this time.
0 commit comments