• Tom Lane's avatar
    Avoid assuming that instr_time == struct timeval in pgbench logging. · 74baa1e3
    Tom Lane authored
    This code was presuming undue familiarity with the contents of the
    instr_time struct.  That was already broken on Windows, and it's about
    to get broken on most other platforms as well.  The simplest solution
    that preserves the current output definition is to just do our own
    gettimeofday() call here.  Realistically, the extra cost is probably
    negligible in comparison to everything else that's going on in a
    pgbench transaction, so it's not worth sweating over.
    
    On Windows, the precision delivered by gettimeofday() is lower than
    one could wish, but this is still a big improvement over printing
    zeroes, as the code did before.
    
    Discussion: https://postgr.es/m/8837.1483216839@sss.pgh.pa.us
    74baa1e3
pgbench.c 119 KB