-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTimePointInterface.php
More file actions
76 lines (66 loc) · 2.05 KB
/
TimePointInterface.php
File metadata and controls
76 lines (66 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
namespace Icecave\Chrono;
use DateTime as NativeDateTime;
use Icecave\Chrono\TimeSpan\Duration;
use Icecave\Chrono\TimeSpan\Period;
use Icecave\Chrono\TimeSpan\TimeSpanInterface;
use Icecave\Parity\ExtendedComparable;
use Icecave\Parity\RestrictedComparable;
/**
* Represents a concrete point on the time continuum.
*/
interface TimePointInterface extends DateInterface, TimeInterface, ExtendedComparable, RestrictedComparable
{
/**
* @return int The number of seconds since unix epoch (1970-01-01 00:00:00+00:00).
*/
public function unixTime();
/**
* @return TimeZone The time zone of the time point.
*/
public function timeZone();
/**
* @return NativeDateTime A native PHP DateTime instance representing this time point.
*/
public function nativeDateTime();
/**
* Add a time span to the time point.
*
* @param TimeSpanInterface|int $timeSpan A time span instance, or an integer representing seconds.
*
* @return TimePointInterface
*/
public function add($timeSpan);
/**
* Subtract a time span from the time point.
*
* @param TimeSpanInterface|int $timeSpan A time span instance, or an integer representing seconds.
*
* @return TimePointInterface
*/
public function subtract($timeSpan);
/**
* Calculate the difference between this time point and another in seconds.
*
* @param TimePointInterface $timePoint
*
* @return int
*/
public function differenceAsSeconds(self $timePoint);
/**
* Calculate the difference between this time point and another, representing the result as a duration.
*
* @param TimePointInterface $timePoint
*
* @return Duration
*/
public function differenceAsDuration(self $timePoint);
/**
* Calculate the difference between this time point and another, representing the result as a duration.
*
* @param TimePointInterface $timePoint
*
* @return Period
*/
public function differenceAsPeriod(self $timePoint);
}