Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
apachedex
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
apachedex
Commits
4e344683
Commit
4e344683
authored
Apr 09, 2013
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add comments on error caused by time approximations.
Some are corrected, others are TODO.
parent
fa46d997
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
apachedex/__init__.py
apachedex/__init__.py
+6
-1
No files found.
apachedex/__init__.py
View file @
4e344683
...
...
@@ -813,6 +813,7 @@ period_parser = {
# Longest month: 31 days
timedelta
(
31
),
lambda
x
:
x
,
# Error margin without correction: 3/31 = 10%
lambda
x
:
31.
/
calendar
.
monthrange
(
x
.
year
,
x
.
month
)[
1
],
),
'quarter'
:
(
...
...
@@ -824,6 +825,7 @@ period_parser = {
'%Y/%m/%d'
,
timedelta
(
7
),
_roundWeek
,
# Error margin without correction: (366 % 7 = 2) 2/7 = 29%
_getWeekCoefficient
,
),
'month'
:
(
...
...
@@ -834,7 +836,8 @@ period_parser = {
# Longest day: 24 hours + 1h DST (never more ?)
timedelta
(
seconds
=
3600
*
25
),
lambda
x
:
x
,
lambda
x
:
1
,
# XXX: take DST into account (1/24th) ?
# Error margin without correction: (DST) 1/24 = 4%
lambda
x
:
1
,
),
'week'
:
(
# XXX: should be "7 days", but a single word is more convenient
_as6HourString
,
...
...
@@ -843,6 +846,7 @@ period_parser = {
'%Y/%m/%d %H'
,
timedelta
(
seconds
=
3600
*
6
),
_round6Hour
,
# Error margin without correction: (DST) 1/6 = 17%
lambda
x
:
1
,
),
'day'
:
(
...
...
@@ -853,6 +857,7 @@ period_parser = {
# Longest hour: 60 * 60 seconds + 1 leap second.
timedelta
(
seconds
=
3601
),
lambda
x
:
x
,
# Error margin without correction: (leap) 1/3600 = .03%
lambda
x
:
1
,
),
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment