Skip to content
Snippets Groups Projects
  • David M. Lee's avatar
    40caf0ad
    Replaces clock_gettime() with ast_tsnow() · 40caf0ad
    David M. Lee authored
    clock_gettime() is, unfortunately, not portable. But I did like that
    over our usual `ts.tv_nsec = tv.tv_usec * 1000` copy/paste code we
    usually do when we want a timespec and all we have is ast_tvnow().
    
    This patch adds ast_tsnow(), which mimics ast_tvnow(), but returns a
    timespec. If clock_gettime() is available, it will use that. Otherwise
    ast_tsnow() falls back to using ast_tvnow().
    
    Change-Id: Ibb1ee67ccf4826b9b76d5a5eb62e90b29b6c456e
    40caf0ad
    History
    Replaces clock_gettime() with ast_tsnow()
    David M. Lee authored
    clock_gettime() is, unfortunately, not portable. But I did like that
    over our usual `ts.tv_nsec = tv.tv_usec * 1000` copy/paste code we
    usually do when we want a timespec and all we have is ast_tvnow().
    
    This patch adds ast_tsnow(), which mimics ast_tvnow(), but returns a
    timespec. If clock_gettime() is available, it will use that. Otherwise
    ast_tsnow() falls back to using ast_tvnow().
    
    Change-Id: Ibb1ee67ccf4826b9b76d5a5eb62e90b29b6c456e