title: are these msec<->timeval functions correct?
body: <p>I have a bug in this program, and I keep coming back to these two functions, but they look right to me. Anything wrong here?</p>
  
  <pre><code>long visual_time_get_msec(VisTime *time_)
  {
      visual_log_return_val_if_fail(time_ != NULL, 0);
  
      return time_-&gt;tv_sec * 1000 + time_-&gt;tv_usec / 1000;
  }
  
  
  int visual_time_set_from_msec(VisTime *time_, long msec)
  {
      visual_log_return_val_if_fail(time_ != NULL, -VISUAL_ERROR_TIME_NULL);
  
  
      long sec = msec / 1000;
      long usec = 0;
  
      visual_time_set(time_, sec, usec);
  
      return VISUAL_OK;
  }
  </code></pre>