1/* 2 * Copyright (c) 1985, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 40 unchanged lines hidden (view full) --- 49ualarm(usecs, reload) 50 register unsigned usecs; 51 register unsigned reload; 52{ 53 struct itimerval new, old; 54 55 new.it_interval.tv_usec = reload % USPS; 56 new.it_interval.tv_sec = reload / USPS; |
57 |
58 new.it_value.tv_usec = usecs % USPS; 59 new.it_value.tv_sec = usecs / USPS; 60 61 if (setitimer(ITIMER_REAL, &new, &old) == 0) 62 return (old.it_value.tv_sec * USPS + old.it_value.tv_usec); 63 /* else */ 64 return (-1); 65} |