PluginProbe
Media Cloud Sync / 1.2.8
Media Cloud Sync v1.2.8
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 / Timestamp.php

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

178 lines 7.4 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/timestamp.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 Timestamp represents a point in time independent of any time zone or local
12 * calendar, encoded as a count of seconds and fractions of seconds at
13 * nanosecond resolution. The count is relative to an epoch at UTC midnight on
14 * January 1, 1970, in the proleptic Gregorian calendar which extends the
15 * Gregorian calendar backwards to year one.
16 * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
17 * second table is needed for interpretation, using a [24-hour linear
18 * smear](https://developers.google.com/time/smear).
19 * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
20 * restricting to that range, we ensure that we can convert to and from [RFC
21 * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
22 * # Examples
23 * Example 1: Compute Timestamp from POSIX `time()`.
24 * Timestamp timestamp;
25 * timestamp.set_seconds(time(NULL));
26 * timestamp.set_nanos(0);
27 * Example 2: Compute Timestamp from POSIX `gettimeofday()`.
28 * struct timeval tv;
29 * gettimeofday(&tv, NULL);
30 * Timestamp timestamp;
31 * timestamp.set_seconds(tv.tv_sec);
32 * timestamp.set_nanos(tv.tv_usec * 1000);
33 * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
34 * FILETIME ft;
35 * GetSystemTimeAsFileTime(&ft);
36 * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
37 * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
38 * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
39 * Timestamp timestamp;
40 * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
41 * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
42 * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
43 * long millis = System.currentTimeMillis();
44 * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
45 * .setNanos((int) ((millis % 1000) * 1000000)).build();
46 * Example 5: Compute Timestamp from Java `Instant.now()`.
47 * Instant now = Instant.now();
48 * Timestamp timestamp =
49 * Timestamp.newBuilder().setSeconds(now.getEpochSecond())
50 * .setNanos(now.getNano()).build();
51 * Example 6: Compute Timestamp from current time in Python.
52 * timestamp = Timestamp()
53 * timestamp.GetCurrentTime()
54 * # JSON Mapping
55 * In JSON format, the Timestamp type is encoded as a string in the
56 * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
57 * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
58 * where {year} is always expressed using four digits while {month}, {day},
59 * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
60 * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
61 * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
62 * is required. A proto3 JSON serializer should always use UTC (as indicated by
63 * "Z") when printing the Timestamp type and a proto3 JSON parser should be
64 * able to accept both UTC and other timezones (as indicated by an offset).
65 * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
66 * 01:30 UTC on January 15, 2017.
67 * In JavaScript, one can convert a Date object to this format using the
68 * standard
69 * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
70 * method. In Python, a standard `datetime.datetime` object can be converted
71 * to this format using
72 * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
73 * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
74 * the Joda Time's [`ISODateTimeFormat.dateTime()`](
75 * http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
76 * ) to obtain a formatter capable of generating timestamps in this format.
77 *
78 * Generated from protobuf message <code>google.protobuf.Timestamp</code>
79 */
80 class Timestamp extends \Dudlewebs\WPMCS\Google\Protobuf\Internal\TimestampBase
81 {
82 /**
83 * Represents seconds of UTC time since Unix epoch
84 * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
85 * 9999-12-31T23:59:59Z inclusive.
86 *
87 * Generated from protobuf field <code>int64 seconds = 1;</code>
88 */
89 protected $seconds = 0;
90 /**
91 * Non-negative fractions of a second at nanosecond resolution. Negative
92 * second values with fractions must still have non-negative nanos values
93 * that count forward in time. Must be from 0 to 999,999,999
94 * inclusive.
95 *
96 * Generated from protobuf field <code>int32 nanos = 2;</code>
97 */
98 protected $nanos = 0;
99 /**
100 * Constructor.
101 *
102 * @param array $data {
103 * Optional. Data for populating the Message object.
104 *
105 * @type int|string $seconds
106 * Represents seconds of UTC time since Unix epoch
107 * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
108 * 9999-12-31T23:59:59Z inclusive.
109 * @type int $nanos
110 * Non-negative fractions of a second at nanosecond resolution. Negative
111 * second values with fractions must still have non-negative nanos values
112 * that count forward in time. Must be from 0 to 999,999,999
113 * inclusive.
114 * }
115 */
116 public function __construct($data = NULL)
117 {
118 \Dudlewebs\WPMCS\GPBMetadata\Google\Protobuf\Timestamp::initOnce();
119 parent::__construct($data);
120 }
121 /**
122 * Represents seconds of UTC time since Unix epoch
123 * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
124 * 9999-12-31T23:59:59Z inclusive.
125 *
126 * Generated from protobuf field <code>int64 seconds = 1;</code>
127 * @return int|string
128 */
129 public function getSeconds()
130 {
131 return $this->seconds;
132 }
133 /**
134 * Represents seconds of UTC time since Unix epoch
135 * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
136 * 9999-12-31T23:59:59Z inclusive.
137 *
138 * Generated from protobuf field <code>int64 seconds = 1;</code>
139 * @param int|string $var
140 * @return $this
141 */
142 public function setSeconds($var)
143 {
144 GPBUtil::checkInt64($var);
145 $this->seconds = $var;
146 return $this;
147 }
148 /**
149 * Non-negative fractions of a second at nanosecond resolution. Negative
150 * second values with fractions must still have non-negative nanos values
151 * that count forward in time. Must be from 0 to 999,999,999
152 * inclusive.
153 *
154 * Generated from protobuf field <code>int32 nanos = 2;</code>
155 * @return int
156 */
157 public function getNanos()
158 {
159 return $this->nanos;
160 }
161 /**
162 * Non-negative fractions of a second at nanosecond resolution. Negative
163 * second values with fractions must still have non-negative nanos values
164 * that count forward in time. Must be from 0 to 999,999,999
165 * inclusive.
166 *
167 * Generated from protobuf field <code>int32 nanos = 2;</code>
168 * @param int $var
169 * @return $this
170 */
171 public function setNanos($var)
172 {
173 GPBUtil::checkInt32($var);
174 $this->nanos = $var;
175 return $this;
176 }
177 }
178