Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support unix timestamps with precision lower than 6 digits #27

Closed
preinheimer opened this issue Oct 23, 2017 · 1 comment
Closed

Support unix timestamps with precision lower than 6 digits #27

preinheimer opened this issue Oct 23, 2017 · 1 comment
Assignees
Labels

Comments

@preinheimer
Copy link

preinheimer commented Oct 23, 2017

Creating a new DateTime with four digits of precision gives an unexpected result.

$time = new DateTimeImmutable('@' . '1508765076.3470');
echo $time->format('r') . "\n";
// Wed, 24 Oct 3517 13:24:36 +0000

$time = new DateTimeImmutable('@' . '1508765076.347000');
echo $time->format('r') . "\n";
// Mon, 23 Oct 2017 13:24:36 +0000

$time = new DateTimeImmutable('@' . '1508765076'); 
echo $time->format('r') . "\n";
// Mon, 23 Oct 2017 13:24:36 +0000

Currently only 6 digits of precision are supported. It seems as though supporting other levels of precision would be helpful.

@derickr derickr added the bug label Aug 9, 2020
@derickr derickr self-assigned this Aug 9, 2020
@derickr derickr changed the title Support unix timestamps with precision other than 6 digits. Support unix timestamps with precision lower than 6 digits Aug 9, 2020
@derickr derickr closed this as completed in 09477f7 Aug 9, 2020
@derickr
Copy link
Owner

derickr commented Aug 9, 2020

I've fixed this for 1-6 digits precision. timelib's resolution isn't higher than µsec, so I can't support more than 6 digits (without discarding the result).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants