Jump to content

Size of integers


MarkJames

Recommended Posts

Sorry - I'm sure this is answered somewhere but I've spent 15 minutes searching without finding so I gave up and posted what could be a dumb question.

 

What size are the integers in ISY?  I'm assuming 32bit?  unsigned?  signed?  

 

I ask because I'm trying to set a variable to time/date stamp when another variable or program has been changed.  Any 'simple' representation of this (311216 for instance for 31st of December, 2016) will be a large integer - especially if I try to time stamp it turning it for, say, 13:57 - it could be 3112161357 - which will just fit into an unsigned 32bit space.  I could drop the 16 to 6 to make it work for 32bit signed.  I *could* break it into two variables - one for date and one for time - but I'd rather not.

 

Of course, if there's a better way to time/date stamp I'd appreciate the input.

 

 

Thanks,

 

mark

Link to comment

Your best bet is to use the sort-of-normal "seconds-since-epoch" for date-time stamps.  That way simple math can easily be used to figure out time deltas - plus it's pretty much just the standard way it's done.  Regarding the integer size -- I've had no difficulties storing an epoch-style value in a variable, so I think it's at least 32 bits -- but I'll defer to others who may have more definitive information on integer size on the ISY.

Link to comment

Variables are 32 bit signed values.

 

v5 also have a decimal precision parameter to indicate where the fixed decimal falls.

 

I use MMDDhhmmss for some time stanps. With v5 seconds since midnite is a built in ISY parameter.

 

 

Here I just used the seconds parameter from v5 ISY.

http://forum.universal-devices.com/topic/17366-v5-tracking-fan-cycle-runtime/

Link to comment

Thanks very much.  That helps a lot.

 

I'm actually going to be doing the math in Homeseer and storing the result in ISY variables.  Part of what I'm after is knowing when sprinkler zones turned on or off and how long they ran for.  This is all reported in the homeseer hspi that mcsSprinklers runs in but I want to display the data on my personal web server and it's easier to grab that from the ISY than from the homeseer where I'd have to use Ajax.

 

Looks like I could just use the javascript getTime() function to get seconds since epoch (or now() for milliseconds)  for start and stop times then

 

 

mark

Link to comment

Archived

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


  • Recently Browsing

    • No registered users viewing this page.
  • Who's Online (See full list)

    • There are no registered users currently online
  • Forum Statistics

    • Total Topics
      36.9k
    • Total Posts
      370.2k
×
×
  • Create New...