Class SimpleTime

Description

Simple time class to perform basic time calculations

Located in /inc/date.php (line 677)


	
			
Variable Summary
boolean $isValid
integer $ticks
array $_cache
Method Summary
SimpleTime SimpleTime ( $time)
void addSecs (integer $s)
void addTime (SimpleTime $t)
void ceilTime (SimpleTime $g)
string dump ([boolean $html = 1])
void floorTime ( $g)
string getHMSstring ()
string getLongString ()
string getShortString ()
string getStringByFormat ( $format)
void max ( $t, SimpleTime $other)
void min (SimpleTime $other)
integer part (char $s)
integer seconds ()
void setStr ( $s)
void setTicks ( $t)
integer subtract (SimpleTime $other)
void timeString ()
void _setTicks ( $s)
Variables
boolean $isValid = 1 (line 692)

is set to a valid value

integer $ticks = '' (line 687)

current time in integer seconds since midnight

array $_cache = array() (line 682)

cache of string formatted data

Methods
Constructor SimpleTime (line 702)

Constructor for class

Accepts the following for the initial time:

  • HH:MM:SS
  • HH:MM (assumes :00 for seconds part)
  • SimpleTime object

SimpleTime SimpleTime ( $time)
  • $time
addSecs (line 763)

add seconds to this time

void addSecs (integer $s)
  • integer $s
addTime (line 964)

Add another time to this time

void addTime (SimpleTime $t)
ceilTime (line 923)

round time up to the nearest $g time-granularity measure

void ceilTime (SimpleTime $g)
dump (line 974)

dump the timestring and ticks in a readable format

  • return: timestring and ticks
string dump ([boolean $html = 1])
  • boolean $html: (optional) use html line endings
floorTime (line 912)

round time down to the nearest $g time-granularity measure

void floorTime ( $g)
  • $g
getHMSstring (line 796)

get a string representation that includes the number of seconds

  • return: time value in HH:MM:SS format
string getHMSstring ()
getLongString (line 819)

get a long string representation for the current locale

  • return: time value in long time format
string getLongString ()
getShortString (line 805)

get a short string representation for the current locale

  • return: time value in short time format
string getShortString ()
getStringByFormat (line 844)

Get a string representation of this time in the specified format

Recognised format characters are as follows:

a Lowercase Ante meridiem and Post meridiem am or pm A Uppercase Ante meridiem and Post meridiem AM or PM g 12-hour format of an hour without leading zeros 1 through 12 G 24-hour format of an hour without leading zeros 0 through 23 h 12-hour format of an hour with leading zeros 01 through 12 H 24-hour format of an hour with leading zeros 00 through 23 i Minutes with leading zeros 00 to 59 s Seconds, with leading zeros 00 through 59

  • return: time value in short time format
string getStringByFormat ( $format)
  • $format
max (line 788)

set this value to the later of $this and $other

void max ( $t, SimpleTime $other)
min (line 780)

set this value to the earlier of $this and $other

void min (SimpleTime $other)
part (line 938)

Obtain hour, minute or seconds parts of the time

return hour, minute or seconds parts of the time, emulating the date('H', $ticks) etc functions, but not using them as they get too badly confused with timezones to be useful in many situations

  • return: part of the time
integer part (char $s)
  • char $s: time part to obtain (valid parts: h, i, s for hours, mins, secs)
seconds (line 772)

return current seconds

  • return: current seconds since midnight
integer seconds ()
setStr (line 716)

Set time by a string

void setStr ( $s)
  • $s
setTicks (line 731)

Set time by seconds since midnight

void setTicks ( $t)
  • $t
subtract (line 755)

subtract seconds $this - $other

  • return: seconds difference
integer subtract (SimpleTime $other)
timeString (line 721)
void timeString ()
_setTicks (line 736)
void _setTicks ( $s)
  • $s

Documentation generated on Tue, 06 Mar 2007 10:01:13 +0000 by phpDocumentor 1.3.0