﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc
20987	Easier expression of time periods	nbachiyski	nacin	"Numbers are cool. But sometimes they stand in the way of what we have to say.

{{{
set_transient( 'plugin_slugs', $plugin_slugs, 86400 );
}}}

From the context it's obvious that 86400 is a time period and with some calculation we can see it's 24 hours/1 day in seconds. Of course, it's not very readable, so usually in the code we see a clarifying comment:

{{{
// 1 day
}}}

This definitely helps. But we could do better. We can make the whole thing read naturally in English:
{{{
set_transient( 'plugin_slugs', $plugin_slugs, DAY_IN_SECONDS );
}}}

This way we get all the information we need – we know the transient is set for one day, we can read this in plain English and we don't need to spare extra cycles to either make mathematical calculations or wait to the end of the line to see the actual period in the comment.

In the patch is attached a new file {{{time-constants.php}}} which contains a couple of constants.

All of them follow the pattern: <SINGULAR_OF_TIME_UNIT>_IN_<PLURAL_OF_TIME_UNIT>.

For now there are only *_IN_SECONDS and *_IN_MINUTES, since that's what we found useful on WordPress.com."	enhancement	closed	normal	3.5	General		normal	fixed	has-patch dev-feedback	rosshanney@… pavelevap@…
