Skip to content
Snippets Groups Projects
  • Deucе's avatar
    795a4211
    When a double is cast to an int, but the double has a larger value · 795a4211
    Deucе authored
    than the int supports, it's set to 0x80000000 to indicate overflow.
    
    msclock() is *always* overflowing, and clock_t is only 32-bits on
    some platforms (specifically FreeBSD).  To "avoid" problems, just
    keep subtracting UIN32_MAX from the value until it's less than INT_MAX
    then cast.
    
    This function is, of course, terrible and shouldn't actually be used,
    but it should at least sorta kinda workish.
    795a4211
    History
    When a double is cast to an int, but the double has a larger value
    Deucе authored
    than the int supports, it's set to 0x80000000 to indicate overflow.
    
    msclock() is *always* overflowing, and clock_t is only 32-bits on
    some platforms (specifically FreeBSD).  To "avoid" problems, just
    keep subtracting UIN32_MAX from the value until it's less than INT_MAX
    then cast.
    
    This function is, of course, terrible and shouldn't actually be used,
    but it should at least sorta kinda workish.