Function reset() in timers library : a double call at get() function


#1

Hi ! I have the following question to ask you :
I would like to use the timer library (R2.1.2) for my project with ESP32 and analyzing the source of the reset function I saw that there is a call to the get function that seems useless, can you explain the meaning?
Thanks in advance.

method:: reset()

    now = __timer_get()
    ret = self.get()                         <--  ret  ..  then overwritten !!

    if now>=self.time:                       <--
        ret = now-self.time                  <--    this is another get()
    else:                                    <--
        ret = 0x3fffffff-self.time+now       <--

    self.time = now
    return ret

#2

Hi @Nico_Ciannella,

thank you for pointing that out. That call is useless at the moment (but not harmful) and we are going to remove it with next patch. It was used with an older version of the Virtual Machine, but not needed anymore :slight_smile: