Jump to content


Photo

[help] os.clock() different behavior with Linux-Mac or Windows???

os.clock() use timer

  • Please log in to reply
3 replies to this topic

#1 Raul (ulneiz)

Raul (ulneiz)

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1290 posts
  • Gender:Male
  • Location:Spain

Posted 21 March 2018 - 01:40

I have a question about the os.clock()...

 

I am using os.clock() with Windows in a tool. I have read here that os.clock() has a different behavior in Linux or Mac different than with Windows.

 

So, if you program a script using os.clock() and tested with Windows, will it behave differently with Linux or Mac?

 

Basically, I have built a panel that blinks and then disappears after a short period of time. I have used os.clock () and add_timer () with Windows. Is there a problem using os.clock () in the 3 operating systems? Will he have a different behavior? Unfortunately I can not test it on Linux or Mac.

 

Thanks!


Edited by Raul (ulneiz), 21 March 2018 - 01:45.

:excl: Development of my tool: GT16-Colors

 

:excl: My API wishlist R3.1 (updated 24 July 2017):

Spoiler

 

:excl: My Renoise 3.1 wishlist (updated 26 September 2017):

Spoiler

#2 joule

joule

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1671 posts
  • Gender:Not Telling
  • Location:Sweden
  • Interests:music, philosophy, engineering

Posted 21 March 2018 - 09:46

Interesting. I didn't know that.. Seems to be a real show stopper for a lot of things, if it's true. (Things like pulsating button colors.. or recording things in your own "sequencer" to a buffer).

 

Surely, the Renoise devs must have modified this behavior to make it consistent?



#3 danoise

danoise

    Probably More God or Borg Than Human Member

  • Renoise Team
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 6749 posts
  • Gender:Male
  • Location:Berlin
  • Interests:wildlife + urban trekking

Posted 21 March 2018 - 10:21

Nope, this is a pain in a lot of places but not the Renoise API. 

 

Here is what the docs have to say about it:

-- Replaced with a high precision timer (still expressed in milliseconds)
os.clock() -> [number]

Tracking with Stuff. API wishlist | Soundcloud


#4 Raul (ulneiz)

Raul (ulneiz)

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1290 posts
  • Gender:Male
  • Location:Spain

Posted 21 March 2018 - 11:41

 

Nope, this is a pain in a lot of places but not the Renoise API. 

 

Here is what the docs have to say about it:

-- Replaced with a high precision timer (still expressed in milliseconds)
os.clock() -> [number]

 

Perfect, thank you very much! I was really concerned about this issue. Then we can program with os.clock() and add_timer() / remove_timer() without having to worry about the operating system. Great!
 
...
 
Another question about os.clock() ...
 
I understand that os.clock () automatically restarts after several seconds have elapsed. Is it necessary to stop it (restart it beforehand) or do something special?
 
If you need to register a period of 7 seconds with os.clock(), and at that moment it restarts automatically, an unexpected behavior could be returned? It would be unusual, a coincidence. But could it happen?
 
How long does it take os.clock () to restart automatically?

:excl: Development of my tool: GT16-Colors

 

:excl: My API wishlist R3.1 (updated 24 July 2017):

Spoiler

 

:excl: My Renoise 3.1 wishlist (updated 26 September 2017):

Spoiler