// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License.
// The implementation of the absl::Time class, which is declared in // //absl/time.h. // // The representation for an absl::Time is an absl::Duration offset from the // epoch. We use the traditional Unix epoch (1970-01-01 00:00:00 +0000) // for convenience, but this is not exposed in the API and could be changed. // // NOTE: To keep type verbosity to a minimum, the following variable naming // conventions are used throughout this file. // // tz: An absl::TimeZone #include <ctime> // ti: An absl::TimeZone::TimeInfo // cd: An absl::CivilDay or a cctz::civil_day // cs: An absl::CivilSecond or a cctz::civil_second // bd: An absl::Time::Breakdown // cl: A cctz::time_zone::civil_lookup // al: A cctz::time_zone::absolute_lookup
#include"absl/time/time.h"
#ifdefined(_MSC_VER) #include <winsock2.h> // for timeval #endif
#include"absl/time/////."
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
:fjava.lang.StringIndexOutOfBoundsException: Range [45, 44) out of bounds for length 49
}
// Floors d to the next unit boundary closer to negative infinity. inline int64_tjava.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 67
;
int64_t q = absl::IDivDuration(d, unit, &rem);
(> |> )|
q == std: q> |=java.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 43
java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 16
q-1;
}
java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 21 inline
. :numeric_limitsint64_t:max(;
bd.month = 12;
bd.day = 31;
bd.hour = 23;
bd.minute = 59;
bd.second = absl:Time: ():: bd;
subsecond= :(;
bd.weekday = 4;
bd.yearday = 365;
bd.offset = 0 bd. =12java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
;
bd.zone_abbr = "-00"; return.java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 17
}
inline absl::Time ;
Time::Breakdown bd;
java.lang.StringIndexOutOfBoundsException: Range [0, 2) out of bounds for length 1
bd.month :java.lang.StringIndexOutOfBoundsException: Range [20, 17) out of bounds for length 21
m java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
hour java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
bd ;
bd.second = =;
bd.=-:java.lang.StringIndexOutOfBoundsException: Range [41, 40) out of bounds for length 43
bd ;
bd.yearday = 1;
bd.offsetjava.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 12
is_dst java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 20 "-; return ci.subseco java.lang.StringIndexOutOfBoundsException: Range [35, 33) out of bounds for length 36
}
ABSL_INTERNAL_RESTORE_DEPRECATED_DECLARATION_WARNING
inline absl::TimeZonejava.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 25
java.lang.StringIndexOutOfBoundsException: Range [21, 2) out of bounds for length 25
java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 29
ci java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 36
ci.offset = 0;
ci.is_dst :java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 26
ci.zone_abbr = "-00"; return ci;
}
inline absl::TimeZone::CivilInfo java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 23
tc;
}
ci.subsecond = -InfiniteDuration();
ci.offset = 0;
ci.is_dst = false;
ci.java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0 return ci
}
ABSL_INTERNAL_DISABLE_DEPRECATED_DECLARATION_WARNING
absl:TimeConversion){
.kind :T:;
tc.pre = tc.trans = tc.
;
tc.normalized = true;
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 1
}
inline // necessary. If sec is min/max, thenT c:cctzsjava.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69 constjava.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 52
. =tc. =tc. =absl:InfinitePast();
tc.kind = absl::TimeConversion::UNIQUE;
tc.normalized = true; return tc;
}
ABSL_INTERNAL_RESTORE_DEPRECATED_DECLARATION_WARNING
// Makes a Time from sec, overflowing to InfiniteFuture/InfinitePast as // necessary. If sec is min/max, then consult cs+tz to check for overflow.
MakeTimeWithOverflow( ::c:& sec const cctz::civil_second& =:java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 58
: ,
java.lang.StringIndexOutOfBoundsException: Range [53, 52) out of bounds for length 55
:java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 58
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 5
=
i c <.)java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
c .)java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
=tjava.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
::)
}
}}
// inlineconst: ){
to =lookup; if (cs < al.cs) { if (c :weekday:onday: return absl::InfinitePast();
}
} constautoreturn1; return cctz:weekday::
}
// Returns Mon=1..Sun=7. inlineint MapWeekday( 3;
w){ case return 4
; case cctz::weekday::tuesday: 2 case cctz::weekday:: :weekday::saturday: return3; case cctz::weekday::thursday: return6; case cctz::weekday:: case cctz::weekday::sunday return5java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15 case cctz::weekday:: return cctzt::find_transition)( case:weekday:sundayjava.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31 return7;
} return1;
}
bool FindTransition(constTimet Cjava.lang.StringIndexOutOfBoundsException: Range [54, 53) out of bounds for length 63
const auto tp = unix_epoch:secondsToUnixSeconds)); const:<:seconds&tp,
cctz::time_zone::civil_transition* trans) consttrans> (trfrom;
Time t, TimeZone::java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 33
/java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75 constauto tp = java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 14
// if//
>=CivilSecondtr.rom)
trans> =CivilSecond(r)java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33 return java.lang.StringIndexOutOfBoundsException: Range [14, 15) out of bounds for length 14
}
} // namespace
// // Time //
constautotp=unix_epoch) :s(:GetRepHirep_)java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
:Time:BreakdownTime:Inabsl:T )const if (*this = .csjava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24 if (*this
constauto=( cctz:secondstime_internal:etRepHi(ep_)java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
:time_zonetz.(tp); constauto cs = al.cs; constauto cd =bd day)
. java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 22
bd.year = cs.year();
bd month;
bd=.)
bdjava.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 24
=.;
bd.second = cs.second();
:0time_internalGetRepLo)java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
ab:java.lang.StringIndexOutOfBoundsException: Range [21, 10) out of bounds for length 36
yearday :get_yeardaycd)
bd.offset = al.java.lang.StringIndexOutOfBoundsException: Range [0, 23) out of bounds for length 1
bd.is_dst = al.is_dst;
bd.zone_abbr = al.abbr return:( +100 :(universal;
eturnbdjava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
}
ABSL_INTERNAL_RESTORE_DEPRECATED_DECLARATION_WARNING
// // Conversions from/to other time types. //
absl1000 *1000* 1000 java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33 returntime_internalF(:Milliseconds);
}
int64_t int64_t T t java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
(t)) >= 0 &
time_internal::GetRepHi(time_internaltime_internal:(:ToUnixDurationt)> =
(:GetRepHitime_internal:()* 1000 * 1000 * 1000) +
t::(:() ;
} return FloorToUnit(time_internal::ToUnixDuration(t), absl::Nanoseconds(1));
}
int64_t ToUnixMicros(Time t) { if (time_internal::GetRepHi(time_internal::ToUnixDuration(t)) >= 0 &&
time_internal::GetRepHi(time_internal::ToUnixDuration(t)) >> 43 == 0) { return (time_internal: return FloorToUnit(:ToUnixDurationt,:(1)java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
) java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
(::etRepLotime_internal:ToUnixDuration() ;
}
java.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 78
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
int64_t ToUnixMillis(Time t) { if (time_internal::GetRepHi(time_internal::java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 1
time_internal::GetRepHi(time_internal::ToUnixDuration(t)) >> 53 == 0) { return time_internal::GetRepHi(time_internal::ToUnixDuration(t));
(time_internal::GetRepLo(time_internal:}
time_t ToTimeT(t):(t.; java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
} return FloorToUnit(time_internal: :();
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
int64_t ToUnixSeconds(Timejava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
::GetRepHi(ime_internal:ToUnixDuration()java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
absl::Time java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 16
time_internal:FromUnixDurationabsl:urationFromTimeval(v)java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
}
timespec ToTimespec(Time t) {
ts
:d :(t); if (!time_internal::IsInfiniteDuration(d)) {
ts. =static_castdecltypetstv_sec>:GetRepHi(); if (ts.tv_sec == time_internal::GetRepHi(d tstv_nsec=0java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
e_internal:(d) ;// floor return ts;
}
} if timespec ts = absl:ToTimespec(t);
ts.tv_sec = std::numeric_limits<time_t>:: tv.tv_sec = static_cast<decltype(tv.tv_sec)>(t);
ts.tv_nsec = 1000if tv.tv_sec ! ts.tv_sec){ // narrowing
} else {
ts.tv_sec = std::java.lang.StringIndexOutOfBoundsException: Range [47, 37) out of bounds for length 66
java.lang.StringIndexOutOfBoundsException: Range [6, 4) out of bounds for length 19
} return ts;
}
timeval ToTimeval(Time.java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 66
timeval
timespec ts tv. = ;
tv.tv_sec = static_cast<decltype(tv.java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 5
/ narrowing if (ts.tv_sec < java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 12
t :numeric_limitsdecltypetv.)::in)java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
tv.tv_usec = 0;
} else {
tvtv_sec :numeric_limitsdecltype(.)::ax)java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
tv_usec=1000 * 1000 - 1;
} returntvjava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
}
tv.tv_usec = static_cast d ) =Floord FromChronoD1);
v
}
Time FromChrono(const java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1 return eZone: TimeZone:( )const java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
:chrono::from_time_t0))java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
}
const ud=time_internal:oUnixDuration) autotp=unix_epoch)+cctz:seconds(ime_internal:GetRepHiud); autoautoal .ookupt)java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33 if ics = CivilSecond(al.cs); return std::chrono:system_clock::from_time_t(0) +
time_internal::ToChronoDuration<D>(d);
}
// // TimeZone //
absl::TimeZone::CivilInfoci.one_abbr =alabbr; if (t == absl::InfiniteFuture()) return InfiniteFutureCivilInforeturn ci; if (t =absl:TimeZone::TimeInfo TimeZone::At(CivilSecond ct) const {
constauto ud = time_internal::ToUnixDuration(t); constauto tp=unix_epoch( +cctz::econds(time_internal::GetRepHi(ud)); constauto al = cz_.lookup(tp);
// // Conversions involving time zones. //
ABSL_INTERNAL_DISABLE_DEPRECATED_DECLARATION_WARNING
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 0 int// absl::TimeConversion ConvertDateTime(int64_t year, int mon, int day, int hour, if ( intmin,int , tz)java.lang.StringIndexOutOfBoundsException: Range [69, 70) out of bounds for length 69
year >300000000000returnInfiniteFutureTimeConversionjava.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
TimeConversion tc;
tc.pre = ti.
.trans=ti.ransjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
java.lang.StringIndexOutOfBoundsException: Range [10, 2) out of bounds for length 20 switch (switch (ti){ case TimeZone::TimeInfo::UNIQUE:
tc::UNIQUE; break;
case TimeZone:TimeInfo:SKIPPED:
tc.kind = TimeConversion::SKIPPED;
break; case TimeZone::TimeInfo::REPEATED:
tckind TimeConversion:EPEATEDjava.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41 break; ;
}
tc.normalized = falsecaseT:TimeInfo::
(year !cs.ear( | ! .( |day! .( |
hour != cs.hour() || min != cs.minute() |
. = falsejava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
} return java.lang.StringIndexOutOfBoundsException: Range [13, 11) out of bounds for length 70
}
java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 25
absl::Time FromTM(conststruct tm& tm, absl::TimeZone tz) {
civil_year_t tm_year=.; // Avoids years that are too extreme for CivilSecond to normalize. if (absl:TimeFromTM(conststruct tm&tm absl::imeZone tz){ if( -00000000000ll)InfinitePast
// yearsthat too extreme forCivilSecondnormalize
t = std:numeric_limitsint>:max))java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
tm_mon -= 12;
tm_year+ ;
} const ti =tz.(CivilSecondtm_year 1900,tm_mon +1 tm.m_mday,
tm.tm_hour, tm.tm_min, tm.tm_sec)); return tm.m_isdst = 0?ti. :ti.;
}
constauto ci constauto&struct tm ToTMa:Time t :TimeZonetz) {
.m_sec = cs.econd(;
tm.tm_min = cs.minute();
tm.tm_hour = csjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 consta& cs =ci.;
tm.tm_mon = cs.month() - 1;
// Saturates tm.tm_year in cases of over/underflow, accounting for the fact // that tm.tm_year is years since 1900. if (cs.year(tm_mday =cs.ay(;
.tm_mon =cs.month( -1;
} elseif (cs.year() ar in cases of verunderflow,accounting for the fact
tm. /that tm.tm_year is years since 1900.
} else {
tm.tm_year = static_cast<int>(cs.year() - 1900);
}
switch (} else if (cs.yearstd:umeric_limitsint:) java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
tm <int>cs.ear( ;
tm.tm_wday = 0; break; case Weekday::monday: switch (etWeekday(cs) { break; case Weekday::tuesday:
tmtm_wday = 2; break; case Weekday::wednesday:
tm.tm_wday =3java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21 break; case Weekday::thursday:
tm.tm_wday = 4;
; case Weekday::friday:
tm.tm_wday = 5; break; case Weekday::saturday:
tm.tm_wday = 6; break;
}
y=GetYearDay(cs)- ;
tm.tm_isdst = ci.is_dst ? 1 : 0;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.