From 8bbda088b6be12a1c8633a05f2c3edee28c3b493 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Mon, 2 Apr 2007 20:42:38 +0000 Subject: cleaned up cxc so that it passes the automated test in scripts/load_every_help.sh: renamed help files to standard name; made each file named after the class; removed non-functional aliases in flatspace svn path=/trunk/externals/cxc/; revision=7538 --- microtime.c | 76 ------------------------------------------------------------- 1 file changed, 76 deletions(-) delete mode 100644 microtime.c (limited to 'microtime.c') diff --git a/microtime.c b/microtime.c deleted file mode 100644 index dea2bb6..0000000 --- a/microtime.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - (c) 2002:cxc@web.fm - microtime: seconds since epoch plus microsecs - */ - -#include -#ifdef NT -#include -#else -#include -#endif -#include - -/* ----------------------- utime --------------------- */ - -static t_class *utime_class; - -typedef struct _utime -{ - t_object x_obj; - t_outlet *x_outlet1; - t_outlet *x_outlet2; -} t_utime; - -static void *utime_new(t_symbol *s, int argc, t_atom *argv) { - t_utime *x = (t_utime *)pd_new(utime_class); - x->x_outlet1 = outlet_new(&x->x_obj, &s_float); - x->x_outlet2 = outlet_new(&x->x_obj, &s_float); - return (x); -} - -#ifndef NT -static void utime_bang(t_utime *x) -{ - struct timeval myutime; - struct timezone mytz; - - gettimeofday(&myutime, &mytz); - outlet_float(x->x_outlet2, (t_float)myutime.tv_usec); - outlet_float(x->x_outlet1, (t_float)myutime.tv_sec); -} -#else -static void utime_bang(t_utime *x) -{ - FILETIME myfiletime; - ULARGE_INTEGER ulfiletime, ulSec, uluSec; - - GetSystemTimeAsFileTime(&myfiletime); - ulfiletime.LowPart = myfiletime.dwLowDateTime; - ulfiletime.HighPart = myfiletime.dwHighDateTime; - ulfiletime.QuadPart -= 116444736000000000; // number of 100ns ticks from 1601-01-01 to 1970-01-01 - ulSec.QuadPart = ulfiletime.QuadPart / (10 * 1000 * 1000); // FILETIME uses 100ns ticks - uluSec.QuadPart = (ulfiletime.QuadPart - ulSec.QuadPart * 10 * 1000 * 1000) / 10; // FILETIME uses 100ns ticks - - outlet_float(x->x_outlet2, (t_float)(__int64)ulSec.QuadPart ); - outlet_float(x->x_outlet1, (t_float)(__int64)uluSec.QuadPart); -} -#endif - -static void help_utime(t_utime *x) -{ - post("\n%c utime\t\t:: get the current system time", 70); - post("\noutputs are\t: seconds since epoch / remaining microseconds"); -} - -void utime_setup(void) -{ - utime_class = class_new(gensym("utime"), - (t_newmethod)utime_new, 0, - sizeof(t_utime), 0, A_GIMME, 0); - - class_addbang(utime_class, utime_bang); - - class_addmethod(utime_class, (t_method)help_utime, gensym("help"), 0); - class_sethelpsymbol(utime_class, gensym("utime.pd")); -} -- cgit v1.2.1