PluginProbe
Media Cloud Sync / 1.2.2
Media Cloud Sync v1.2.2
1.4.2 1.4.1 1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 All 36 releases
media-cloud-sync / includes / sdk / google / google / protobuf / src / Google / Protobuf / Duration.php

Duration.php in Media Cloud Sync 1.2.2, at includes/sdk/google/google/protobuf/src/Google/Protobuf/Duration.php

165 lines 6.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 # Generated by the protocol buffer compiler. DO NOT EDIT!
4 # source: google/protobuf/duration.proto
5 namespace Dudlewebs\WPMCS\Google\Protobuf;
6
7 use Dudlewebs\WPMCS\Google\Protobuf\Internal\GPBType;
8 use Dudlewebs\WPMCS\Google\Protobuf\Internal\RepeatedField;
9 use Dudlewebs\WPMCS\Google\Protobuf\Internal\GPBUtil;
10 /**
11 * A Duration represents a signed, fixed-length span of time represented
12 * as a count of seconds and fractions of seconds at nanosecond
13 * resolution. It is independent of any calendar and concepts like "day"
14 * or "month". It is related to Timestamp in that the difference between
15 * two Timestamp values is a Duration and it can be added or subtracted
16 * from a Timestamp. Range is approximately +-10,000 years.
17 * # Examples
18 * Example 1: Compute Duration from two Timestamps in pseudo code.
19 * Timestamp start = ...;
20 * Timestamp end = ...;
21 * Duration duration = ...;
22 * duration.seconds = end.seconds - start.seconds;
23 * duration.nanos = end.nanos - start.nanos;
24 * if (duration.seconds < 0 && duration.nanos > 0) {
25 * duration.seconds += 1;
26 * duration.nanos -= 1000000000;
27 * } else if (duration.seconds > 0 && duration.nanos < 0) {
28 * duration.seconds -= 1;
29 * duration.nanos += 1000000000;
30 * }
31 * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
32 * Timestamp start = ...;
33 * Duration duration = ...;
34 * Timestamp end = ...;
35 * end.seconds = start.seconds + duration.seconds;
36 * end.nanos = start.nanos + duration.nanos;
37 * if (end.nanos < 0) {
38 * end.seconds -= 1;
39 * end.nanos += 1000000000;
40 * } else if (end.nanos >= 1000000000) {
41 * end.seconds += 1;
42 * end.nanos -= 1000000000;
43 * }
44 * Example 3: Compute Duration from datetime.timedelta in Python.
45 * td = datetime.timedelta(days=3, minutes=10)
46 * duration = Duration()
47 * duration.FromTimedelta(td)
48 * # JSON Mapping
49 * In JSON format, the Duration type is encoded as a string rather than an
50 * object, where the string ends in the suffix "s" (indicating seconds) and
51 * is preceded by the number of seconds, with nanoseconds expressed as
52 * fractional seconds. For example, 3 seconds with 0 nanoseconds should be
53 * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
54 * be expressed in JSON format as "3.000000001s", and 3 seconds and 1
55 * microsecond should be expressed in JSON format as "3.000001s".
56 *
57 * Generated from protobuf message <code>google.protobuf.Duration</code>
58 */
59 class Duration extends \Dudlewebs\WPMCS\Google\Protobuf\Internal\Message
60 {
61 /**
62 * Signed seconds of the span of time. Must be from -315,576,000,000
63 * to +315,576,000,000 inclusive. Note: these bounds are computed from:
64 * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
65 *
66 * Generated from protobuf field <code>int64 seconds = 1;</code>
67 */
68 protected $seconds = 0;
69 /**
70 * Signed fractions of a second at nanosecond resolution of the span
71 * of time. Durations less than one second are represented with a 0
72 * `seconds` field and a positive or negative `nanos` field. For durations
73 * of one second or more, a non-zero value for the `nanos` field must be
74 * of the same sign as the `seconds` field. Must be from -999,999,999
75 * to +999,999,999 inclusive.
76 *
77 * Generated from protobuf field <code>int32 nanos = 2;</code>
78 */
79 protected $nanos = 0;
80 /**
81 * Constructor.
82 *
83 * @param array $data {
84 * Optional. Data for populating the Message object.
85 *
86 * @type int|string $seconds
87 * Signed seconds of the span of time. Must be from -315,576,000,000
88 * to +315,576,000,000 inclusive. Note: these bounds are computed from:
89 * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
90 * @type int $nanos
91 * Signed fractions of a second at nanosecond resolution of the span
92 * of time. Durations less than one second are represented with a 0
93 * `seconds` field and a positive or negative `nanos` field. For durations
94 * of one second or more, a non-zero value for the `nanos` field must be
95 * of the same sign as the `seconds` field. Must be from -999,999,999
96 * to +999,999,999 inclusive.
97 * }
98 */
99 public function __construct($data = NULL)
100 {
101 \Dudlewebs\WPMCS\GPBMetadata\Google\Protobuf\Duration::initOnce();
102 parent::__construct($data);
103 }
104 /**
105 * Signed seconds of the span of time. Must be from -315,576,000,000
106 * to +315,576,000,000 inclusive. Note: these bounds are computed from:
107 * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
108 *
109 * Generated from protobuf field <code>int64 seconds = 1;</code>
110 * @return int|string
111 */
112 public function getSeconds()
113 {
114 return $this->seconds;
115 }
116 /**
117 * Signed seconds of the span of time. Must be from -315,576,000,000
118 * to +315,576,000,000 inclusive. Note: these bounds are computed from:
119 * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
120 *
121 * Generated from protobuf field <code>int64 seconds = 1;</code>
122 * @param int|string $var
123 * @return $this
124 */
125 public function setSeconds($var)
126 {
127 GPBUtil::checkInt64($var);
128 $this->seconds = $var;
129 return $this;
130 }
131 /**
132 * Signed fractions of a second at nanosecond resolution of the span
133 * of time. Durations less than one second are represented with a 0
134 * `seconds` field and a positive or negative `nanos` field. For durations
135 * of one second or more, a non-zero value for the `nanos` field must be
136 * of the same sign as the `seconds` field. Must be from -999,999,999
137 * to +999,999,999 inclusive.
138 *
139 * Generated from protobuf field <code>int32 nanos = 2;</code>
140 * @return int
141 */
142 public function getNanos()
143 {
144 return $this->nanos;
145 }
146 /**
147 * Signed fractions of a second at nanosecond resolution of the span
148 * of time. Durations less than one second are represented with a 0
149 * `seconds` field and a positive or negative `nanos` field. For durations
150 * of one second or more, a non-zero value for the `nanos` field must be
151 * of the same sign as the `seconds` field. Must be from -999,999,999
152 * to +999,999,999 inclusive.
153 *
154 * Generated from protobuf field <code>int32 nanos = 2;</code>
155 * @param int $var
156 * @return $this
157 */
158 public function setNanos($var)
159 {
160 GPBUtil::checkInt32($var);
161 $this->nanos = $var;
162 return $this;
163 }
164 }
165