Jump to content

UNIX Time


apostolakisl

Recommended Posts

Posted

As per the 5.0 thread, UNIX time would be a valuable addition as a "system value" that can be compared to or set to a variable.  Or some approximation of UNIX time with a continuously running second counter that starts from some fixed time in the past.

Posted

Got my vote.    Just start the cumulative seconds counter at the beginning of a New Year for easy math calculations based on it.

 

eg. Current year = Integer (Cumulative second counter /3600/24/365.25) + Year base.

 

 

This can be used to integrate rates from quantity measurement devices, even through a power outage and reboot of the ISY. 

     kWH--> kW,      ft^3. -->  ft^3/hour,     anemometer revolution counts -->wind speed

 

 

   Furnace run time (in hours) = (end cumm_seconds - start cumm_seconds)  / 3600

      Note: no new days, ends of months, ends of years to calculate in

Posted

Hi guys,

 

Are you requesting for the 4 byte unsigned int that we use internally that represents the number of seconds since epoch? Or, are you requesting a variable that can be set to x and then incremented every second? The latter - and without a lot of overhead - will not be trivial.

 

With kind regards,

Michel

Posted

Hi guys,

 

Are you requesting for the 4 byte unsigned int that we use internally that represents the number of seconds since epoch? Or, are you requesting a variable that can be set to x and then incremented every second? The latter - and without a lot of overhead - will not be trivial.

 

With kind regards,

Michel

 

The variable doesn't need to update automatically.  That would require a lot of overhead as you said and I think be unnecessary.  Just the ability to test variables against the epoch or set a variable to epoch upon a program requesting it.

 

The idea would be, upon needing to know  a time interval, you set your variable to current epoch time or add/subtract a past saved epoch time from the current epoch time.

 

This is great news that you already use epoch time.  I assume that since this is a system value and that you have already worked out the details of connecting system values to variables, it might be added with little effort?

 

For example

New Program - [ID 014C][Parent 014B]

If
   - No Conditions - (To add one, press 'Schedule' or 'Condition')
 
Then
        
        $Epoch = [Seconds since Jan 1 1970 GMT]
 
Else
   - No Actions - (To add one, press 'Action')
 

Posted

Hi guys,

 

Are you requesting for the 4 byte unsigned int that we use internally that represents the number of seconds since epoch? Or, are you requesting a variable that can be set to x and then incremented every second? The latter - and without a lot of overhead - will not be trivial.

 

With kind regards,

Michel

Access to the Epoch variable. The only caveat I see is that you stated it is an unsigned value. I would likely need to be converted to signed for usage with the current math operations used elsewhere in ISY.

 

Sign truncation to disallow negative values may work after year 2038 when the sign value would be conflicted with. A later base year (say 2000 or other leap year 0  base  would keep the overflow problem later in the century and the math easier) for users but means some ISY CPU time every second to do the constant subtraction.

 

 

On the WebControl  board application the seconds counter starts at 0 every reboot. We just use the delta counter for accurate passed time. Time slicing executives can use it

   seconds_counter mod x = 0 for events every x seconds.

 

.... however Apostolakisl sees a bigger picture for extracting real time events from it. I am not sure with the combination of available real time variable and a floating time base the need is there. Either way would be fine by me.

 

It does not need to be settable, just available for math operations, usually delta seconds.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...