webCOMAND

\io_comand_util\time

The time class provides static methods to simplify timing processes and reporting on time durations, as well as converting between standard Unix timestamps and COMAND repository Time or Timestamp field formats.

Example

use \io_comand_util\time;

// time some code
$start = time::get_time();
sleep(250);
$duration = time::get_duration($start);
echo("Slept for $duration\n");

// set a new object's timestamp field
$repo = comand::repo();
$event = $repo->new_object('Event');
$event->Timestamp = time::get_timestamp();

// format an object's timestamp field value
$repo = comand::repo();
$event = $repo->get_first('FROM Event');
$time = time::format_timestamp($event->Timestamp);
echo("Event happened $time\n");