Sometimes the grib records in a file may not be sorted into the correct time order.

You can use ecCodes to sort the grib records into ascending time order:

grib_copy -B "date asc, time:i asc, step:i asc, level:i asc" in.grib out.grib.

(Thanks to L Jones for the helpful tip)

Kevin