Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


Recommended Posts

Posted (edited)

I have a little problem but I do not know what could be wrong. :(

I have two time stamp. And wanted to calculate the difference between these.

timestamp1 = 2025-03-21T7:18:0Z

timestamp2 = 2025-03-21T8:21:56Z

my coding: 

elapsed_time = os.difftime(end_time, start_time)

the result is:

time elapsed: 236.0

This means in seconds, and it is about 3 minutes. But the right result hsould be 1 hour and 3 minutes.

What could be wrong here?

 

BUT!

if the difference is more that 1 hour...it works perfectly!

timestamp1 = 2025-03-21T6:18:0Z

timestamp2 = 2025-03-21T8:57:23Z

the result is: 1 hour 39 minutes, what is right

Edited by BernhardtZs
Posted

For me it works. You have an HC3 or HC3 Lite ?

Alt. 236 is 3min and 56secs. Do you parse the timestamp wrong?

timestamp1 = 2025-03-21T7:18:0Z

timestamp2 = 2025-03-21T8:21:56Z

21:56-18 .... ?

 

  • Topic Author
  • Posted

    Hi!

    The calculation looks like 8:21:56 - 7:18:0.

    For me this is 1:03:56.

    What is 3836 sec.

    :(

    Posted

    I just tried to compare the two times (quick and dirty). Tested on a YH.

    Please login or register to see this code.

    This prints out 3836.0 what is correct.

    So perhaps you can show more of your code to evaluate what possibly could go wrong.

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Reply to this topic...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...