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

Feature Request: Milliseconds Support #22

Open
USSX-Hares opened this issue Mar 11, 2020 · 2 comments
Open

Feature Request: Milliseconds Support #22

USSX-Hares opened this issue Mar 11, 2020 · 2 comments

Comments

@USSX-Hares
Copy link

Hi there
It would be nice to add milliseconds support to this tool

I was able to do that at runtime by overriding some internal values with the following code part:

import re
from pytimeparse import timeparse
timeparse.MILLIS = r'(?P<millis>[\d.]+)\s*(?:ms|msecs?|millis|milliseconds?)'
timeparse.TIMEFORMATS[0] += r'\s*' + timeparse.OPT(timeparse.MILLIS)
timeparse.MULTIPLIERS['millis'] = 1e-3
timeparse.COMPILED_TIMEFORMATS[0] = re.compile(r'\s*' + timeparse.TIMEFORMATS[0] + r'\s*$', re.I)
onegreyonewhite added a commit to onegreyonewhite/pytimeparse2 that referenced this issue Nov 3, 2021
Resolves wroberts#22
Co-authored-by: Peter Zaitcev <USSX.Hares@yandex.ru>
@onegreyonewhite
Copy link

@USSX-Hares thanx for idea. It was added to pytimeparse2==1.3.0

@2br-2b
Copy link

2br-2b commented May 8, 2023

Just a note, I think this may be a duplicate of #17

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

No branches or pull requests

3 participants