Skip to:
Content

BuddyPress.org

Ticket #4310: 4310.01.patch

File 4310.01.patch, 1.3 KB (added by r-a-y, 10 years ago)
  • src/bp-core/bp-core-functions.php

     
    759759 * @since BuddyPress (1.2.6)
    760760 *
    761761 * @param bool $gmt True to use GMT (rather than local) time. Default: true.
     762 * @param bool $unix True to use UNIX timestamp. False to use formatted date.
     763 *        Default: false.
    762764 * @return string Current time in 'Y-m-d h:i:s' format.
    763765 */
    764 function bp_core_current_time( $gmt = true ) {
    765         // Get current time in MYSQL format
    766         $current_time = current_time( 'mysql', $gmt );
     766function bp_core_current_time( $gmt = true, $unix = false ) {
     767        if ( true == $unix ) {
     768                $mode = 'timestamp';
     769        } else {
     770                $mode = 'mysql';
     771        }
     772
     773        // Get current time
     774        $current_time = current_time( $mode, $gmt );
    767775
    768776        return apply_filters( 'bp_core_current_time', $current_time );
    769777}
     
    828836         * a date and the current time. $newer_date will have a value if we want to
    829837         * work out time elapsed between two known dates.
    830838         */
    831         $newer_date = ( !$newer_date ) ? strtotime( bp_core_current_time() ) : $newer_date;
     839        $newer_date = ( !$newer_date ) ? bp_core_current_time( true, true ) : $newer_date;
    832840
    833841        // Difference in seconds
    834842        $since = $newer_date - $older_date;