comparison src/animate.c @ 120:5df7403b6fbc

Fix bug of get_now()
author Thinker K.F. Li <thinker@branda.to>
date Sun, 14 Sep 2008 23:05:30 +0800
parents 257a1d314bcd
children 17e97e92b76e
comparison
equal deleted inserted replaced
119:257a1d314bcd 120:5df7403b6fbc
72 #include "redraw_man.h" 72 #include "redraw_man.h"
73 #include "mb_timer.h" 73 #include "mb_timer.h"
74 #include "animate.h" 74 #include "animate.h"
75 75
76 76
77 #define STEP_INTERVAL 100000 77 #define STEP_INTERVAL 50000
78 #define ASSERT(x) 78 #define ASSERT(x)
79 79
80 /*! \brief A word is a set of concurrent actions in a program. 80 /*! \brief A word is a set of concurrent actions in a program.
81 */ 81 */
82 struct _mb_word { 82 struct _mb_word {
204 /* 204 /*
205 * Any two actions in concurrent words never change the same attribute. 205 * Any two actions in concurrent words never change the same attribute.
206 * Start time of words in a program are specified in incremental order. 206 * Start time of words in a program are specified in incremental order.
207 */ 207 */
208 static void mb_progm_step(const mb_timeval_t *tmo, 208 static void mb_progm_step(const mb_timeval_t *tmo,
209 const mb_timeval_t *now, 209 const mb_timeval_t *now,
210 void *arg) { 210 void *arg) {
211 mb_progm_t *progm = (mb_progm_t *)arg; 211 mb_progm_t *progm = (mb_progm_t *)arg;
212 mb_timeval_t next_tmo; 212 mb_timeval_t next_tmo;
213 mb_word_t *word; 213 mb_word_t *word;
214 mb_timer_t *timer; 214 mb_timer_t *timer;
215 int i; 215 int i;
216 216
217 MB_TIMEVAL_SET(&next_tmo, 0, STEP_INTERVAL); 217 MB_TIMEVAL_SET(&next_tmo, 0, STEP_INTERVAL);
218 MB_TIMEVAL_ADD(&next_tmo, tmo); 218 MB_TIMEVAL_ADD(&next_tmo, now);
219 219
220 /* _step() or _stop() words that in playing. */ 220 /* _step() or _stop() words that in playing. */
221 i = progm->first_playing; 221 i = progm->first_playing;
222 for(word = progm->words + i; 222 for(word = progm->words + i;
223 i < progm->n_words && MB_TIMEVAL_LATER(tmo, &word->abs_start); 223 i < progm->n_words && MB_TIMEVAL_LATER(tmo, &word->abs_start);