test: Calculate timeout in milliseconds

This changes the timeout granularity from seconds to milliseconds. This is useful in issues such as #4932.

The default test timeout is now 30000ms (30s) per @isaacs suggestion, down from 60s.