/* * set any of the following * - time in nsec * - nsec trim applied over some seconds * - clock frequency */ static int writebintime(char *buf, int n) { uint8_t *p; int64_t delta; int32_t period; n--; p = (uint8_t*)buf + 1; switch(*buf){ case 'n': if(n < sizeof(int64_t)) error(Ebadtimectl); le2int64_t(&delta, p); todset(delta, 0, 0); break; case 'd': if(n < sizeof(int64_t)+sizeof(int32_t)) error(Ebadtimectl); p = le2int64_t(&delta, p); le2long(&period, p); todset(-1, delta, period); break; case 'f': if(n < sizeof(uint64_t)) error(Ebadtimectl); le2int64_t(&fasthz, p); todsetfreq(fasthz); break; } return n; }
/* * set any of the following * - time in nsec * - nsec trim applied over some seconds * - clock frequency */ static int writebintime(char *buf, int n) { uint8_t *p; int64_t delta = 0; long period = 0; n--; p = (uint8_t *) buf + 1; switch (*buf) { case 'n': if (n < sizeof(int64_t)) error(EINVAL, ERROR_FIXME); le2int64_t(&delta, p); #if 0 todset(delta, 0, 0); #endif break; case 'd': if (n < sizeof(int64_t) + sizeof(long)) error(EINVAL, ERROR_FIXME); p = le2int64_t(&delta, p); le2long(&period, p); #if 0 todset(-1, delta, period); #endif break; case 'f': if (n < sizeof(uint64_t)) error(EINVAL, ERROR_FIXME); le2int64_t(&fasthz, p); if (fasthz <= 0) error(EINVAL, ERROR_FIXME); #if 0 todsetfreq(fasthz); #endif break; } return n; }