Decimal value rounded after insert into DB

Hi,

I have following script that measures the time between actions
put now into startTime
do something
put now minus startTime into entry 
The output of entry looks like this: 0.584 seconds

I use
put first word of entry into durationTime
to get rid of the seconds so that I can insert the value into the DB using the add records command.

After successful insert 0.584 is rounded to 1 though...

Is there a way to prevent that from happening?
Also why do I get the 'seconds' string in the first place? Is there a way to only get the time it took?

Thanks in advance

Comments

  • SenseTalkDougSenseTalkDoug ForumAdmin admin
    When you subtract one time from another, the result is a time duration with units of seconds. You can remove the units by adding this line:
    set entry's units to empty
    
    That will make entry into a plain number with no units.

    I'm not sure why the number is being rounded to 1 when you insert it into the database, but I would guess you may be entering it into a column that's defined as an integer?
  • GhostGhost Member
    Thanks for your help.

    And the column is formatted as Decimal. I have tried it several times with long running operations as well and all time values get rounded and inserted into the DB
Sign In or Register to comment.