Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #98412

Re: time module

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Dennis Lee Bieber <wlfraed@ix.netcom.com>
Newsgroups comp.lang.python
Subject Re: time module
Date Sat, 07 Nov 2015 19:19:00 -0500
Organization IISS Elusive Unicorn
Lines 53
Message-ID <mailman.114.1446941944.16136.python-list@python.org> (permalink)
References <K0u%x.70622$_R5.38436@fx07.am1>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
X-Trace news.uni-berlin.de klQGIWrhY5N6F41HjFPFeA+kh5WkFsKHluj2bMMv0Rmw==
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'message-id:@4ax.com': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:module': 0.09; 'zero.': 0.09; 'python': 0.10; 'jan': 0.11; 'program?': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'seconds.': 0.16; 'time.time()': 0.16; 'zero...': 0.16; 'url:home': 0.18; '>>>': 0.20; '2015': 0.20; 'represents': 0.23; 'sat,': 0.23; 'import': 0.24; 'module': 0.25; 'example': 0.26; 'header:X-Complaints-To:1': 0.26; 'fastest': 0.27; 'function': 0.28; 'prints': 0.29; 'starts': 0.29; "i'm": 0.30; 'print': 0.30; 'seconds': 0.31; 'skip:3 10': 0.35; 'could': 0.35; 'nov': 0.35; 'subject:time': 0.35; 'something': 0.35; 'but': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'skip:5 10': 0.37; 'skip:8 10': 0.37; 'charset:us-ascii': 0.37; 'skip:4 10': 0.38; 'to:addr:python.org': 0.40; 'skip:6 10': 0.67; 'worth': 0.67; 'internet': 0.70; '(35': 0.84; 'dennis': 0.91; 'received:108': 0.93
X-Injected-Via-Gmane http://gmane.org/
X-Gmane-NNTP-Posting-Host adsl-108-68-178-61.dsl.klmzmi.sbcglobal.net
X-Newsreader Forte Agent 6.00/32.1186
X-No-Archive YES
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:98412

Show key headers only | View raw


On Sat, 07 Nov 2015 21:27:06 GMT, input/ldompeling@casema.nl declaimed the
following:

>hi,
>
>I like to have a function that prints time in seconds.
>I am looking for something for example that seconds count from zero.
>I search the internet for time module in python but could not found anathing usefull.
>

	Ambiguous requirement: any normal counter starts from zero... But what
"zero" represents may differ... Seconds since Jan 1 1970? Seconds since
midnight? Seconds since start of program?

>>> import time
>>> t0 = time.time()
>>> t0
1446941608.052
>>> t0 / 60.0
24115693.467533335
>>> t0 / 60.0 / 60.0
401928.22445888893
>>> t0 / 60.0 / 60.0 / 24.0
16747.009352453704
>>> t0 / 60.0 / 60.0 / 24.0 / 365.25
45.850812737724034
>>> 

	Almost 46 years worth of seconds.

>>> tStart = time.time()
>>> for x in range(10):
... 	time.sleep(x)
... 	print time.time() - tStart
... 	
36.5020000935
37.5040001869
39.5090000629
42.5099999905
46.5170001984
51.5190000534
57.5200002193
64.5210001469
72.5230000019
81.5230000019
>>> 

Okay, I'm not the fastest typist (35 seconds from tStart to finishing the
loop code)
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

time module input/ldompeling@casema.nl - 2015-11-07 21:27 +0000
  Re: time module Cameron Simpson <cs@zip.com.au> - 2015-11-08 08:47 +1100
  Re: time module Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-11-07 19:19 -0500
    Re: time module input/ldompeling@casema.nl - 2015-11-08 10:25 +0000
      Re: time module Marko Rauhamaa <marko@pacujo.net> - 2015-11-08 13:05 +0200

csiph-web