aboutsummaryrefslogtreecommitdiff
path: root/sc4pd/source/support.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sc4pd/source/support.cpp')
-rw-r--r--sc4pd/source/support.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/sc4pd/source/support.cpp b/sc4pd/source/support.cpp
index 2e06e9e..8d80bbe 100644
--- a/sc4pd/source/support.cpp
+++ b/sc4pd/source/support.cpp
@@ -35,15 +35,14 @@
*/
#include <flext.h>
+#include <flsupport.h>
#include "SC_PlugIn.h"
-#include <sys/time.h>
#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406)
#error You need at least FLEXT version 0.4.6
#endif
-
bool sc_add (flext::AtomList a)
{
for (int i = 0; i!=a.Count();++i)
@@ -96,7 +95,16 @@ bool sc_ar(flext::AtomList a)
int32 timeseed()
{
static int32 count = 0;
- struct timeval tv;
- gettimeofday(&tv, 0);
- return (int32)tv.tv_sec ^ (int32)tv.tv_usec ^ count--;
+
+ double time = flext::GetOSTime();
+
+ double sec = trunc(time);
+ double usec = (time-sec)*1e6;
+
+ time_t tsec = sec;
+ suseconds_t tusec =usec; /* not exacty the way, it's calculated
+ in SuperCollider, but it's only
+ the seed */
+
+ return (int32)tsec ^ (int32)tusec ^ count--;
}