File: time.py

package info (click to toggle)
python-measurement 2.0.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 332 kB
  • sloc: python: 1,327; makefile: 137
file content (32 lines) | stat: -rw-r--r-- 705 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from measurement.base import MeasureBase


__all__ = [
    'Time',
]


class Time(MeasureBase):

    """ Time measurements (generally for multidimensional measures).

    Please do not use this for handling durations of time unrelated to
    measure classes -- python's built-in datetime module has much better
    functionality for handling intervals of time than this class provides.

    """
    STANDARD_UNIT = 's'
    UNITS = {
        's': 1.0,
        'min': 60.0,
        'hr': 3600.0,
        'day': 86400.0
    }
    ALIAS = {
        'second': 's',
        'sec': 's',  # For backward compatibility
        'minute': 'min',
        'hour': 'hr',
        'day': 'day'
    }
    SI_UNITS = ['s']