os.time()

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Anthony

    #1

    os.time()

    i have a problem with the os.times() command, on different Python
    versions, i get different printout:

    Server1# python
    Python 2.3.4 (#1, Feb 2 2005, 11:44:13)
    [GCC 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)] on linux2
    Type "help", "copyright" , "credits" or "license" for more information.[color=blue][color=green][color=darkred]
    >>> import time
    >>> import os
    >>>
    >>> print os.times()[4][/color][/color][/color]
    4880406.62


    ----------------------------------
    Server2% python
    Python 2.3.2 (#4, Sep 14 2004, 09:41:45) [C] on sunos5
    Type "help", "copyright" , "credits" or "license" for more information.[color=blue][color=green][color=darkred]
    >>> import time
    >>> import os
    >>>
    >>> print os.times()[4][/color][/color][/color]
    -21464227.74


    ---------------
    Server3% python
    Python 2.4.1 (#1, May 16 2005, 15:19:29)
    [GCC 4.0.0 20050512 (Red Hat 4.0.0-5)] on linux2
    Type "help", "copyright" , "credits" or "license" for more information.[color=blue][color=green][color=darkred]
    >>> import time
    >>> import os
    >>>
    >>> print os.times()[4][/color][/color][/color]
    18390711.21



    and on the 3 servers, the linux command: $date
    returns the same value.....

    any suggestions???
    what is the command that gives me the actual time?

  • Diez B. Roggisch

    #2
    Re: os.time()

    Anthony wrote:
    [color=blue]
    > i have a problem with the os.times() command, on different Python
    > versions, i get different printout:[/color]
    <snip/>
    [color=blue]
    > and on the 3 servers, the linux command: $date
    > returns the same value.....
    >
    > any suggestions???
    > what is the command that gives me the actual time?[/color]

    time.time(), not os.times(). The latter is for process-times. No idea why it
    can become _negative, though.

    Diez

    Comment

    • Steve Holden

      #3
      Re: os.time()

      Diez B. Roggisch wrote:[color=blue]
      > Anthony wrote:
      >
      >[color=green]
      >>i have a problem with the os.times() command, on different Python
      >>versions, i get different printout:[/color]
      >
      > <snip/>
      >[color=green]
      >>and on the 3 servers, the linux command: $date
      >>returns the same value.....
      >>
      >>any suggestions???
      >>what is the command that gives me the actual time?[/color]
      >
      >
      > time.time(), not os.times(). The latter is for process-times. No idea why it
      > can become _negative, though.
      >
      > Diez[/color]

      WANTED: reliable benchmarks to improve Python speed/performance estimation.
      REWARD: the thanks of the whole community.

      I spent some time at the recent Need For Speed sprint addressing
      benchmarking questions, and discovered that we need more benchmark tests
      for speed and perfomance. Sean Reifenshneider seems to be on the trail
      of one addition, but the, more the merrier. It's not easy to write good
      benchmarks ...

      regards
      Steve
      --
      Steve Holden +44 150 684 7255 +1 800 494 3119
      Holden Web LLC/Ltd http://www.holdenweb.com
      Love me, love my blog http://holdenweb.blogspot.com
      Recent Ramblings http://del.icio.us/steve.holden

      Comment

      • Steve Holden

        #4
        Re: os.time()

        Diez B. Roggisch wrote:[color=blue]
        > Anthony wrote:
        >
        >[color=green]
        >>i have a problem with the os.times() command, on different Python
        >>versions, i get different printout:[/color]
        >
        > <snip/>
        >[color=green]
        >>and on the 3 servers, the linux command: $date
        >>returns the same value.....
        >>
        >>any suggestions???
        >>what is the command that gives me the actual time?[/color]
        >
        >
        > time.time(), not os.times(). The latter is for process-times. No idea why it
        > can become _negative, though.
        >
        > Diez[/color]

        WANTED: reliable benchmarks to improve Python speed/performance estimation.
        REWARD: the thanks of the whole community.

        I spent some time at the recent Need For Speed sprint addressing
        benchmarking questions, and discovered that we need more benchmark tests
        for speed and perfomance. Sean Reifenshneider seems to be on the trail
        of one addition, but the, more the merrier. It's not easy to write good
        benchmarks ...

        regards
        Steve
        --
        Steve Holden +44 150 684 7255 +1 800 494 3119
        Holden Web LLC/Ltd http://www.holdenweb.com
        Love me, love my blog http://holdenweb.blogspot.com
        Recent Ramblings http://del.icio.us/steve.holden

        Comment

        Working...