More portable solution based on Date.now()

Thanks to @juliangruber and @rvagg.