I am making the TimesPC structure popular, the intention is that users can always enter values in seconds (0.01 seconds) ), So we are converting seconds into nanoseconds: Thanks in advance. Code> Enter the code here String Times Exec {time_t tv_sec; / * Seconds * / long TV_NSC; / * Nanoseconds /}; Structure itimerspec {struct timespec it_interval; / * Timer Interval * / Straight TimesPack it_value; / * Initial Term * /}; I'm trying to get the code here: Read the environmental variable as a double, store the second part in TV_SC and store part of nanosecond in TV_NSC. lt_leak_start = atoll (getenv ("LT_LEAK_START")) * sec_to_nsec; where the variable
is fixed long sec_to_nsec = 1000000000; and then using it as a logic for the settime:
timer_settime (timerid, 0, & amp; its, NULL) .
Fixed long sec_to_nsec = 1000000000; Lt_leak_start = Atoll (getenv ("LT_LEAK_START")) * sec_to_nsec; / * Set timer interval * / its.it_interval.tv_sec = 0; Its.it_interval.tv_nsec = 1; / * Timer End Setting * / its.it_value.tv_sec = 0; // First end after 1 second its.it_value.tv_nsec = lt_leak_start; Timer_create (CLOCK_REALTIME, & amp; sevp, & timerid); If (timer_settime (timer, 0, and, its, nouvel) == - 1) {false ("overturned"); Exit (1); }
double D = strotode (getenv ("LT_LEAK_START"), 0 ); ... its.it_value.tv_sec = (time_t) D; Its.it_value.tv_nsec = (d - (time_t) d) * sec_to_nsec;
Comments
Post a Comment