Right, you don't solve for time, you make that one of your given variables. Start with an initial pressure, initial spring force. Start as a given, the piston mass, the fluid state (pressure and temperature), initial fluid volume, piston diameter, fluid type if using a computer database for properties, time step (dt), a value for friction coefficient of the seals, seal height (to determine frictional seal load), and maybe the polytropic exponent if you're using that method to determine fluid states (alternatively you can use your fluids database and fluid properties such as entropy, internal energy, density, etc... to determine fluid state. You will also need heat flux if you want to go to those lengths. Heat flux is a function of dT across the cylinder wall and frictional heating for reciprocating pistons).
I would run the calculations across a row in a spreadsheet with dt in the first column. Next columns, put pressure, temperature, piston pressure load, piston spring load, calculate acceleration, calculate velocity, calculate position, calculate new fluid properties, etc...
This is essentially the Simpson rule, though you'll find you can often do some averaging, so you essentially turn the integration into a trapazoidal rule.
Make a bunch of graphs that show the location of the piston, velocity, etc...
Make dt a variable, then change it, making it smaller. You should find that for too large a value of dt, the piston location and velocity are completely eratic. As you make the dt variable smaller and smaller, the graphs all stop changing. You're done.
I'd be interested in seeing how others approach this problem.