Tstoeckler's comment (#8) in #1403508: show "just now" instead of "1 second ago" after posting nodes and comments made me realize that the variable naming in format_interval() could be improved slightly:

/**
 * Formats a time interval with the requested granularity.
 *
 * @param $timestamp
 *   The length of the interval in seconds.
 * [...]
 */

$timestamp is somewhat misleading here, since that should be differences of timestamps instead being an actual timestamp.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

scorchio’s picture

Status: Needs work » Needs review
FileSize
1.83 KB

Here's a patch which (hopefully) solves this issue.

Status: Needs review » Needs work

The last submitted patch, improve_variable_naming_format_interval-1416218-1.patch, failed testing.

tstoeckler’s picture

Status: Needs work » Reviewed & tested by the community
Issue tags: +Needs backport to D6, +Needs backport to D7

Testbot is broken currently. When it is back up, this is RTBC.
Since this is only renaming an internal variable it constitutes a doc change (i.e. no API change), and hence can be backported all the way to D6 if I'm not mistaken.

Dries’s picture

Version: 8.x-dev » 6.x-dev

Nice correction. Interval is the proper word. I think the 'just now' idea is pretty neat too.

Anyway, committed this patch to 8.x and 7.x. Moving it to 6.x in case Gabor wants to consider it.

Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Patch (to be ported)

Looks like a good improvement, but does not apply to Drupal 6.

scorchio’s picture

Status: Patch (to be ported) » Needs review
FileSize
1.77 KB

Thanks everyone - it feels great to do something for Drupal, even if it's just a tiny improvement like this :) Here's the one against 6.x.

Status: Needs review » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.