-------------------------------------------------------------------------*\ * Determines how much time we have left for the next system call, * if the previous call was a failure * Input * tm: timeout control structure * Returns * the number of ms left or -1 if there is no time limit \*-------------------------------------------------------------------------*/
| 91 | * the number of ms left or -1 if there is no time limit |
| 92 | \*-------------------------------------------------------------------------*/ |
| 93 | double timeout_getretry(p_timeout tm) { |
| 94 | if (tm->block < 0.0 && tm->total < 0.0) { |
| 95 | return -1; |
| 96 | } else if (tm->block < 0.0) { |
| 97 | double t = tm->total - timeout_gettime() + tm->start; |
| 98 | return MAX(t, 0.0); |
| 99 | } else if (tm->total < 0.0) { |
| 100 | double t = tm->block - timeout_gettime() + tm->start; |
| 101 | return MAX(t, 0.0); |
| 102 | } else { |
| 103 | double t = tm->total - timeout_gettime() + tm->start; |
| 104 | return MIN(tm->block, MAX(t, 0.0)); |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | /*-------------------------------------------------------------------------*\ |
| 109 | * Marks the operation start time in structure |
no test coverage detected