Making WordPress.org

Changeset 7977


Ignore:
Timestamp:
12/17/2018 07:34:19 AM (7 years ago)
Author:
vedjain
Message:

WCPT Application Tracker: Send time from server because client can have clock skew, and therefore cannot be trusted.

Location:
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/javascript/tracker/source/tracker.jsx

    r7976 r7977  
    1313 * Looks like exact javascript convert of WordPress's human_time_diff, except this always compares from current time, instead of getting two arguments.
    1414 *
    15  * @param {int} date Unix timestamp date to compare from
     15 * @param {int} seconds Seconds ago to convert to human readable time
    1616 *
    1717 * @returns {string} Human readable time ago
    1818 */
    19 const timeSince = ( date ) => {
    20 
    21     const seconds = Math.floor( (new Date() / 1000 ) - date );
     19const timeSince = ( seconds ) => {
    2220
    2321    let interval = Math.floor(seconds / 31536000);
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-event/tracker.php

    r7976 r7977  
    7070            'milestone'  => $milestones[ $post->post_status ],
    7171            'status'     => $statuses[ $post->post_status ],
    72             'lastUpdate' => $last_update_timestamp,
     72            'lastUpdate' => time() - $last_update_timestamp,
    7373        );
    7474    }
Note: See TracChangeset for help on using the changeset viewer.