src/PelEntryTime.php
public function setValue($timestamp, $type = self::UNIX_TIMESTAMP)
    {
        switch ($type) {
            case self::UNIX_TIMESTAMP:
                $this->day_count = $this->convertUnixToJd($timestamp);
                $this->seconds = $timestamp % 86400;
                break;

            case self::EXIF_STRING:
                /* Clean the timestamp: some timestamps are broken other
                 * separators than ':' and ' '. */
                $d = preg_split('/[^0-9]+/', $timestamp);
                for ($i = 0; $i < 6; $i ++) {
                    if (empty($d[$i])) {
                        $d[$i] = 0;
                    }
                }
                $this->day_count = $this->convertGregorianToJd($d[0], $d[1], $d[2]);
                $this->seconds = $d[3] * 3600 + $d[4] * 60 + $d[5];
                break;

            case self::JULIAN_DAY_COUNT:
                $this->day_count = (int) floor($timestamp);
                $this->seconds = (int) (86400 * ($timestamp - floor($timestamp)));
                break;

            default:
                throw new PelInvalidArgumentException(
                    'Expected UNIX_TIMESTAMP (%d), ' . 'EXIF_STRING (%d), or ' . 'JULIAN_DAY_COUNT (%d) for $type, got %d.',
                    self::UNIX_TIMESTAMP,
                    self::EXIF_STRING,
                    self::JULIAN_DAY_COUNT,
                    $type
                );
        }

        /*
         * Now finally update the string which will be used when this is
         * turned into bytes.
         */
        parent::setValue($this->getValue(self::EXIF_STRING));
    }
public function setValue($timestamp, $type = self::UNIX_TIMESTAMP)
    {
        switch ($type) {
            case self::UNIX_TIMESTAMP:
                $this->day_count = $this->convertUnixToJd($timestamp);
                $this->seconds = $timestamp % 86400;
                break;

            case self::EXIF_STRING:
                /* Clean the timestamp: some timestamps are broken other
                 * separators than ':' and ' '. */
                $d = preg_split('/[^0-9]+/', $timestamp);
                for ($i = 0; $i < 6; $i ++) {
                    if (empty($d[$i])) {
                        $d[$i] = 0;
                    }
                }
                $this->day_count = $this->convertGregorianToJd($d[0], $d[1], $d[2]);
                $this->seconds = $d[3] * 3600 + $d[4] * 60 + $d[5];
                break;

            case self::JULIAN_DAY_COUNT:
                $this->day_count = (int) floor($timestamp);
                $this->seconds = (int) (86400 * ($timestamp - floor($timestamp)));
                break;

            default:
                throw new PelInvalidArgumentException(
                    'Expected UNIX_TIMESTAMP (%d), ' . 'EXIF_STRING (%d), or ' . 'JULIAN_DAY_COUNT (%d) for $type, got %d.',
                    self::UNIX_TIMESTAMP,
                    self::EXIF_STRING,
                    self::JULIAN_DAY_COUNT,
                    $type
                );
        }

        /*
         * Now finally update the string which will be used when this is
         * turned into bytes.
         */
        parent::setValue($this->getValue(self::EXIF_STRING));
    }
public function setValue ( $ timestamp , $ type = self :: UNIX_TIMESTAMP ) { switch ( $ type ) { case self :: UNIX_TIMESTAMP : $ this -> day_count = $ this -> convertUnixToJd ( $ timestamp ) ; $ this -> seconds = $ timestamp % 86400 ; break ; case self :: EXIF_STRING : /* Clean the timestamp: some timestamps are broken other
                 * separators than ':' and ' '. */ $ d = preg_split ( '/[^0-9]+/' , $ timestamp ) ; for ( $ i = 0 ; $ i < 6 ; $ i ++ ) { if ( empty ( $ d [ $ i ] ) ) { $ d [ $ i ] = 0 ; } } $ this -> day_count = $ this -> convertGregorianToJd ( $ d [ 0 ] , $ d [ 1 ] , $ d [ 2 ] ) ; $ this -> seconds = $ d [ 3 ] * 3600 + $ d [ 4 ] * 60 + $ d [ 5 ] ; break ; case self :: JULIAN_DAY_COUNT : $ this -> day_count = ( int ) floor ( $ timestamp ) ; $ this -> seconds = ( int ) ( 86400 * ( $ timestamp - floor ( $ timestamp ) ) ) ; break ; default : throw new PelInvalidArgumentException ( 'Expected UNIX_TIMESTAMP (%d), ' . 'EXIF_STRING (%d), or ' . 'JULIAN_DAY_COUNT (%d) for $type, got %d.' , self :: UNIX_TIMESTAMP , self :: EXIF_STRING , self :: JULIAN_DAY_COUNT , $ type ) ; } /*
         * Now finally update the string which will be used when this is
         * turned into bytes.
         */ parent :: setValue ( $ this -> getValue ( self :: EXIF_STRING ) ) ; }
Update the timestamp held by this entry.

@param integer $timestamp
the timestamp held by this entry in the correct form
as indicated by the third argument. For {@link UNIX_TIMESTAMP}
this is an integer counting the number of seconds since January
1st 1970, for {@link EXIF_STRING} this is a string of the form
'YYYY:MM:DD hh:mm:ss', and for {@link JULIAN_DAY_COUNT} this is a
floating point number where the integer part denotes the day
count and the fractional part denotes the time of day (0.25 means
6:00, 0.75 means 18:00).

@param integer $type
the type of the timestamp. This must be one of
{@link UNIX_TIMESTAMP}, {@link EXIF_STRING}, or
{@link JULIAN_DAY_COUNT}.
Update the timestamp held by this entry .