How to enter time strings in config files
You machine configuration files are full of settings which require time values to be entered, such as "10 seconds" or "250 milliseconds."
Rather than arbitrarily decide which values should be entered as seconds versus milliseconds, we've built MPF so that you can enter either one whenever a time entry is needed which MPF will internally convert to the proper value.
These time values are used all over the place. (Ball device count delays, ball save time, ball search settings, reset delays, slide expiration times, etc.)
We'll use an example from a ball device for the
setting. (Again, this is just an example. You use these same options
whenever you need to enter a time value):
Entering a time duration in seconds
To enter a time duration in seconds, simply add an "s" or "sec" after your number. (This can be uppercase or lowercase and you can put a space in between your number and the letters if you want.) Some examples:
ball_count_delay: 0.5s ball_count_delay: 0.5 S ball_count_delay: 0.5sec
Entering a time duration in milliseconds
To enter a time duration in seconds, simply add an "ms" or "msec" after your number. (This can be uppercase or lowercase, and you can put a space in between your number and the letters if you want.)
Note that if you do not enter and letters, then MPF will read in the time duration in whatever the default scale is for that particular setting. (The instructions for each setting should say whether the default is seconds or ms.
ball_count_delay: 500ms ball_count_delay: 500 MS ball_count_delay: 500msec ball_count_delay: 500
It makes no difference whether you enter your time durations as seconds or milliseconds, as MPF will convert everything to milliseconds (since that's the default for ball_count_delay when it reads in your configuration files.
Entering a time duration in minutes, hours, or days
You can also enter time strings in MPF for time periods longer than seconds or milliseconds. While this isn't practical for things like ball device delays, it's used in certain modules (like the credits module) for some settings.
credit_expiration_time: 2m # 2 minutes credit_expiration_time: 2h # 2 hours credit_expiration_time: 2d # 2 days
Something missing or wrong? You can fix it!
This website is edited by people like you! Is something wrong or missing? Is something out of date, or can you explain it better?
Please help us! You can fix it yourself and be an official "open source" contributor!
It's easy! See our Beginner's guide to editing the docs.
Page navigation via the keyboard: < >
You can navigate this site via the keyboard. There are two modes:
General navigation, when search is not focused:
- F , S , / : open search dialog
- P , , : go to previous page
- N , . : go to next page
While using the search function:
- Down , Up : select next / previous result
- Esc , Tab : close search
- Enter : go to highlighted page in the results