Remade binning function using numpy functions arange and histogram.  Note: if the last time value exactly coincides with a bin edge, it looks like the binning will ignore its existence.