(seconds, microseconds, proc, clientData)
| 999 | * |
| 1000 | * Results: |
| 1001 | * The return value is a token for the timer event, which |
| 1002 | * may be used to delete the event before it fires. |
| 1003 | * |
| 1004 | * Side effects: |
| 1005 | * When seconds and seconds have elapsed, proc will be invoked |
| 1006 | * exactly once. |
| 1007 | * |
| 1008 | *-------------------------------------------------------------- |
| 1009 | */ |
| 1010 | |
| 1011 | Tk_TimerToken |
| 1012 | Tk_CreateMicroTimerHandler(seconds, microseconds, proc, clientData) |
| 1013 | int seconds; /* How many seconds to wait |
| 1014 | * before invoking proc. */ |
| 1015 | int microseconds; /* How many microseconds to wait |
| 1016 | * before invoking proc. */ |
| 1017 | Tk_TimerProc *proc; /* Procedure to invoke. */ |
| 1018 | ClientData clientData; /* Arbitrary data to pass to proc. */ |
| 1019 | { |
| 1020 | register TimerEvent *timerPtr, *tPtr2, *prevPtr; |
| 1021 | static int id = 0; |
| 1022 | |
| 1023 | timerPtr = NewTimerEvent(); |
| 1024 | |
| 1025 | /* |
| 1026 | * Compute when the event should fire. |
| 1027 | */ |
| 1028 | |
| 1029 | (void) gettimeofday(&timerPtr->time, (struct timezone *) NULL); |
| 1030 | timerPtr->time.tv_sec += seconds; |
| 1031 | timerPtr->time.tv_usec += microseconds; |
| 1032 | while (timerPtr->time.tv_usec > 1000000) { |
| 1033 | timerPtr->time.tv_usec -= 1000000; |
| 1034 | timerPtr->time.tv_sec += 1; |
| 1035 | } |
| 1036 | |
| 1037 | /* |
| 1038 | * Fill in other fields for the event. |
| 1039 | */ |
| 1040 | |
| 1041 | timerPtr->proc = proc; |
| 1042 | timerPtr->clientData = clientData; |
| 1043 | id++; |
| 1044 | timerPtr->token = (Tk_TimerToken) id; |
| 1045 | |
| 1046 | /* |
| 1047 | * Add the event to the queue in the correct position |
| 1048 | * (ordered by event firing time). |
| 1049 | */ |
| 1050 | |
| 1051 | for (tPtr2 = timerQueue, prevPtr = NULL; tPtr2 != NULL; |
| 1052 | prevPtr = tPtr2, tPtr2 = tPtr2->nextPtr) { |
| 1053 | if ((tPtr2->time.tv_sec > timerPtr->time.tv_sec) |
| 1054 | || ((tPtr2->time.tv_sec == timerPtr->time.tv_sec) |
| 1055 | && (tPtr2->time.tv_usec > timerPtr->time.tv_usec))) { |
| 1056 | break; |
| 1057 | } |
| 1058 | } |
no outgoing calls
no test coverage detected