Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3940046
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T00:22:17+00:00 2026-05-20T00:22:17+00:00

I am reading a log file in my python script, and I have got

  • 0

I am reading a log file in my python script, and I have got a list of tuples of startTimes and endTimes –

('[19:49:40:680]', '[19:49:49:128]')
('[11:29:10:837]', '[11:29:15:698]')
('[11:30:18:291]', '[11:30:21:025]')
('[11:37:44:293]', '[11:38:02:008]')
('[11:39:14:897]', '[11:39:21:572]')
('[11:42:19:968]', '[11:42:22:036]')
('[11:43:18:887]', '[11:43:19:633]')
('[11:44:26:533]', '[11:49:29:274]')
('[11:55:03:974]', '[11:55:06:372]')
('[11:56:14:096]', '[11:56:14:493]')
('[11:57:08:372]', '[11:57:08:767]')
('[11:59:26:201]', '[11:59:27:438]')

How can I take a difference of the times in milliseconds?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T00:22:18+00:00Added an answer on May 20, 2026 at 12:22 am
    >>> import datetime
    >>> a = ('[19:49:40:680]', '[19:49:49:128]')
    >>> start = datetime.datetime.strptime(a[0][:-1]+"000", "[%H:%M:%S:%f")
    >>> end = datetime.datetime.strptime(a[1][:-1]+"000", "[%H:%M:%S:%f")
    >>> delta = end-start
    >>> ms = delta.seconds*1000 + delta.microseconds/1000
    >>> ms
    8448.0
    

    This even works if the clock wraps around at midnight:

    >>> a = ('[23:59:59:000]','[00:00:01:000]')
    >>> # <snip> see above
    >>> ms = delta.seconds*1000 + delta.microseconds/1000
    >>> ms
    2000.0
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a log file that I am reading to a string public static
I'm reading in data about an HTTP access log. I've got a file with
i am reading a csv file into a list of a list in python.
I am working on a log parsing script using Perl. I am reading the
I have a big log file, over 1 million lines. I need to use
I have a log file assume it to be any text(txt) file. I am
I am reading an external log file via xslt, and i want to find
I am reading from a log file. My target is to display the 10
I have to read the tomcat log file,and after some time(for example:one hour) I
I have log file of multi threaded application. Each line has a well know

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.