MOO-cows Mailing List Archive

[Prev][Next][Index][Thread]

Re: time() built-in



static package
bf_us_time(Var arglist, Byte next, void *vdata, Objid progr)
{
    Var r;
    struct timevel *tv = (struct timeval *)alloc_data(sizeof(struct timeval));
    struct timezone *tz = 0;

    gettimeofday(tv, tz);

    r = new_float(((double)tv->tv_sec) + ((double)tv->tv_usec / 1000000));
    
    free_data(tv);
    free_var(arglist);
    return make_var_pack(r);
}

and in register_extensions...
     register_function("us_time", 0, 0, bf_us_time);

In answer to your second question, send mail to MOO-Cows-Request@xerox.com with the single line message "subscribe MOO-Cows".

---
   Brian Buchanan    sysop@calbbs.com    brian@wasteland.calbbs.com
-= ArchWizard of Digital Wasteland MOO (wasteland.calbbs.com 8888) =-


Follow-Ups:

Home | Subject Index | Thread Index