The proper fix here would be a cast to intmax_t and snprintf("%jd")