- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.threeten.bp.zone.ZoneOffsetTransition
类的一些代码示例,展示了ZoneOffsetTransition
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZoneOffsetTransition
类的具体详情如下:
包路径:org.threeten.bp.zone.ZoneOffsetTransition
类名称:ZoneOffsetTransition
[英]A transition between two offsets caused by a discontinuity in the local time-line.
A transition between two offsets is normally the result of a daylight savings cutover. The discontinuity is normally a gap in spring and an overlap in autumn. ZoneOffsetTransition models the transition between the two offsets.
Gaps occur where there are local date-times that simply do not not exist. An example would be when the offset changes from +03:00 to +04:00. This might be described as 'the clocks will move forward one hour tonight at 1am'.
Overlaps occur where there are local date-times that exist twice. An example would be when the offset changes from +04:00 to +03:00. This might be described as 'the clocks will move back one hour tonight at 2am'.
This class is immutable and thread-safe.
[中]由当地时间线的不连续性引起的两个偏移之间的过渡。
两个偏移之间的过渡通常是夏令时切换的结果。这种不连续性通常是春季的一个间隙,秋季的一个重叠。ZoneOffsetTransition为两个偏移之间的过渡建模。
当本地日期时间根本不存在时,就会出现间隔。例如,偏移从+03:00更改为+04:00。这可能被描述为“时钟将在今晚凌晨1点向前移动一小时”。
如果存在两次本地日期时间,则会发生重叠。例如,偏移从+04:00更改为+03:00。这可以被描述为“今晚凌晨2点钟会向后拨一小时”。
####实施者规范
这个类是不可变的,是线程安全的。
代码示例来源:origin: org.threeten/threetenbp
/**
* Finds the offset info for a local date-time and transition.
*
* @param dt the date-time, not null
* @param trans the transition, not null
* @return the offset info, not null
*/
private Object findOffsetInfo(LocalDateTime dt, ZoneOffsetTransition trans) {
LocalDateTime localTransition = trans.getDateTimeBefore();
if (trans.isGap()) {
if (dt.isBefore(localTransition)) {
return trans.getOffsetBefore();
}
if (dt.isBefore(trans.getDateTimeAfter())) {
return trans;
} else {
return trans.getOffsetAfter();
}
} else {
if (dt.isBefore(localTransition) == false) {
return trans.getOffsetAfter();
}
if (dt.isBefore(trans.getDateTimeAfter())) {
return trans.getOffsetBefore();
} else {
return trans;
}
}
}
代码示例来源:origin: stackoverflow.com
public boolean isExtraHour(final ZonedDateTime time) {
final ZoneOffsetTransition dayTransition = time.getZone().getRules()
.getTransition(time.toLocalDateTime());
return dayTransition != null && dayTransition.isOverlap() && dayTransition.getInstant()
.equals(time.toInstant());
}
代码示例来源:origin: ThreeTen/threetenbp
ZoneOffset before = wallOffsets[i];
ZoneOffset after = wallOffsets[i + 1];
ZoneOffsetTransition trans = new ZoneOffsetTransition(savingsInstantTransitions[i], before, after);
if (trans.isGap()) {
localTransitionList.add(trans.getDateTimeBefore());
localTransitionList.add(trans.getDateTimeAfter());
} else {
localTransitionList.add(trans.getDateTimeAfter());
localTransitionList.add(trans.getDateTimeBefore());
代码示例来源:origin: ThreeTen/threetenbp
/**
* Gets the valid offsets during this transition.
* <p>
* A gap will return an empty list, while an overlap will return both offsets.
*
* @return the list of valid offsets
*/
List<ZoneOffset> getValidOffsets() {
if (isGap()) {
return Collections.emptyList();
}
return Arrays.asList(getOffsetBefore(), getOffsetAfter());
}
代码示例来源:origin: stackoverflow.com
LocalDateTime ldt = LocalDateTime.of(2015, 3, 29, 2, 30, 0, 0);
ZoneRules rules = ZoneId.of("Europe/Berlin").getRules();
ZoneOffsetTransition conflict = rules.getTransition(ldt);
if (conflict != null && conflict.isGap()) {
ldt = conflict.getDateTimeAfter();
}
System.out.println(ldt); // 2015-03-29T03:00
代码示例来源:origin: ThreeTen/threetenbp
/**
* Gets the duration of the transition in seconds.
*
* @return the duration in seconds
*/
private int getDurationSeconds() {
return getOffsetAfter().getTotalSeconds() - getOffsetBefore().getTotalSeconds();
}
代码示例来源:origin: org.threeten/threetenbp
this.standardOffsets[0] = baseStandardOffset;
for (int i = 0; i < standardOffsetTransitionList.size(); i++) {
this.standardTransitions[i] = standardOffsetTransitionList.get(i).toEpochSecond();
this.standardOffsets[i + 1] = standardOffsetTransitionList.get(i).getOffsetAfter();
localTransitionOffsetList.add(baseWallOffset);
for (ZoneOffsetTransition trans : transitionList) {
if (trans.isGap()) {
localTransitionList.add(trans.getDateTimeBefore());
localTransitionList.add(trans.getDateTimeAfter());
} else {
localTransitionList.add(trans.getDateTimeAfter());
localTransitionList.add(trans.getDateTimeBefore());
localTransitionOffsetList.add(trans.getOffsetAfter());
this.savingsInstantTransitions[i] = transitionList.get(i).getInstant().getEpochSecond();
代码示例来源:origin: org.threeten/threetenbp
for (TZRule rule : window.ruleList) {
ZoneOffsetTransition trans = rule.toTransition(loopStandardOffset, loopSavings);
if (trans.toEpochSecond() > loopWindowStart.toEpochSecond(loopWindowOffset)) {
new ZoneOffsetTransition(
LocalDateTime.ofEpochSecond(loopWindowStart.toEpochSecond(loopWindowOffset), 0, loopStandardOffset),
loopStandardOffset, window.standardOffset)));
if (loopWindowOffset.equals(effectiveWallOffset) == false) {
ZoneOffsetTransition trans = deduplicate(
new ZoneOffsetTransition(loopWindowStart, loopWindowOffset, effectiveWallOffset));
transitionList.add(trans);
if (trans.toEpochSecond() < loopWindowStart.toEpochSecond(loopWindowOffset) == false &&
trans.toEpochSecond() < window.createDateTimeEpochSecond(loopSavings) &&
trans.getOffsetBefore().equals(trans.getOffsetAfter()) == false) {
transitionList.add(trans);
loopSavings = rule.savingAmountSecs;
代码示例来源:origin: org.threeten/threetenbp
@Override
public ChronoZonedDateTime<D> withEarlierOffsetAtOverlap() {
ZoneOffsetTransition trans = getZone().getRules().getTransition(LocalDateTime.from(this));
if (trans != null && trans.isOverlap()) {
ZoneOffset earlierOffset = trans.getOffsetBefore();
if (earlierOffset.equals(offset) == false) {
return new ChronoZonedDateTimeImpl<D>(dateTime, earlierOffset, zone);
}
}
return this;
}
代码示例来源:origin: ThreeTen/threetenbp
@Override
public ZoneOffset getOffset(Instant instant) {
long epochSec = instant.getEpochSecond();
// check if using last rules
if (lastRules.length > 0 &&
epochSec > savingsInstantTransitions[savingsInstantTransitions.length - 1]) {
int year = findYear(epochSec, wallOffsets[wallOffsets.length - 1]);
ZoneOffsetTransition[] transArray = findTransitionArray(year);
ZoneOffsetTransition trans = null;
for (int i = 0; i < transArray.length; i++) {
trans = transArray[i];
if (epochSec < trans.toEpochSecond()) {
return trans.getOffsetBefore();
}
}
return trans.getOffsetAfter();
}
// using historic rules
int index = Arrays.binarySearch(savingsInstantTransitions, epochSec);
if (index < 0) {
// switch negative insert position to start of matched range
index = -index - 2;
}
return wallOffsets[index + 1];
}
代码示例来源:origin: net.oneandone.ical4j/ical4j
ZoneOffsetKey offfsetKey = ZoneOffsetKey.of(zoneTransitionRule.getOffsetBefore(), zoneTransitionRule.getOffsetAfter());
LocalDateTime start = Collections.min(e.getValue()).getDateTimeBefore();
RDate rDate = new RDate(new ParameterList(), String.format(DATE_TIME_TPL, transition.getDateTimeBefore()));
observance.getProperties().add(rDate);
代码示例来源:origin: org.threeten/threetenbp
} else if (validOffsets.size() == 0) {
ZoneOffsetTransition trans = rules.getTransition(isoLDT);
localDateTime = localDateTime.plusSeconds(trans.getDuration().getSeconds());
offset = trans.getOffsetAfter();
} else {
if (preferredOffset != null && validOffsets.contains(preferredOffset)) {
代码示例来源:origin: stackoverflow.com
LocalDateTime ldt = LocalDate.of(2015, 3, 29).atTime(LocalTime.of(1, 40));
ZoneOffsetTransition conflict = ZoneId.of("Europe/London").getRules().getTransition(ldt);
boolean gap = (conflict != null) && conflict.isGap(); // true
代码示例来源:origin: ThreeTen/threetenbp
for (ZoneOffsetTransition trans : transArray) {
info = findOffsetInfo(dt, trans);
if (info instanceof ZoneOffsetTransition || info.equals(trans.getOffsetBefore())) {
return info;
if (offsetAfter.getTotalSeconds() > offsetBefore.getTotalSeconds()) {
return new ZoneOffsetTransition(dtBefore, offsetBefore, offsetAfter);
} else {
return new ZoneOffsetTransition(dtAfter, offsetBefore, offsetAfter);
代码示例来源:origin: ThreeTen/threetenbp
@Override
public ChronoZonedDateTime<D> withLaterOffsetAtOverlap() {
ZoneOffsetTransition trans = getZone().getRules().getTransition(LocalDateTime.from(this));
if (trans != null) {
ZoneOffset offset = trans.getOffsetAfter();
if (offset.equals(getOffset()) == false) {
return new ChronoZonedDateTimeImpl<D>(dateTime, offset, zone);
}
}
return this;
}
代码示例来源:origin: ThreeTen/threetenbp
ZoneOffsetTransition[] transArray = findTransitionArray(year);
for (ZoneOffsetTransition trans : transArray) {
if (epochSec < trans.toEpochSecond()) {
return trans;
index += 1; // exact match, so need to add one to get the next
return new ZoneOffsetTransition(savingsInstantTransitions[index], wallOffsets[index], wallOffsets[index + 1]);
代码示例来源:origin: stackoverflow.com
ZoneId zoneId = ZoneId.of("Australia/Sydney");
ZoneRules rules = zoneId.getRules();
ZoneOffsetTransition nextTransition = rules.nextTransition(Instant.now());
System.out.println("Next transition at: " +
nextTransition.getInstant().atZone(zoneId));
ZoneOffsetTransition nextNextTransition =
rules.nextTransition(nextTransition.getInstant());
System.out.println("Next transition after that at: " +
nextNextTransition.getInstant().atZone(zoneId));
代码示例来源:origin: org.threeten/threetenbp
@Override
public List<ZoneOffsetTransition> getTransitions() {
List<ZoneOffsetTransition> list = new ArrayList<ZoneOffsetTransition>();
for (int i = 0; i < savingsInstantTransitions.length; i++) {
list.add(new ZoneOffsetTransition(savingsInstantTransitions[i], wallOffsets[i], wallOffsets[i + 1]));
}
return Collections.unmodifiableList(list);
}
代码示例来源:origin: ThreeTen/threetenbp
@Override
public ZoneOffset getOffset(LocalDateTime localDateTime) {
Object info = getOffsetInfo(localDateTime);
if (info instanceof ZoneOffsetTransition) {
return ((ZoneOffsetTransition) info).getOffsetBefore();
}
return (ZoneOffset) info;
}
代码示例来源:origin: net.oneandone.ical4j/ical4j
@Override
public int compare(ZoneOffsetTransition z1, ZoneOffsetTransition z2) {
return z1.getDateTimeBefore().compareTo(z2.getDateTimeBefore());
}
});
在类中实现 NSCopying 的此方法以启用复制时,区域参数使用什么?如果我设置一个新对象,我不需要用 allocWithZone 来分配它,因为 alloc 就足够了......我很困惑.....
本文整理了Java中io.sphere.sdk.zones.Zone.getLocations()方法的一些代码示例,展示了Zone.getLocations()的具体用法。这些代码示例主要来源于Gi
本文整理了Java中io.sphere.sdk.zones.Zone.getId()方法的一些代码示例,展示了Zone.getId()的具体用法。这些代码示例主要来源于Github/Stackover
本文整理了Java中io.sphere.sdk.zones.Zone.referenceTypeId()方法的一些代码示例,展示了Zone.referenceTypeId()的具体用法。这些代码示例主
本文整理了Java中io.kaif.model.zone.Zone.valueOf()方法的一些代码示例,展示了Zone.valueOf()的具体用法。这些代码示例主要来源于Github/Stacko
本文整理了Java中io.kaif.model.zone.Zone.tryFallback()方法的一些代码示例,展示了Zone.tryFallback()的具体用法。这些代码示例主要来源于Githu
我的数据库中恰好有包含 timestamp without time zone 列的表。现在我需要根据时区比较它们。 我可以这样做: select my_timestamp::timestamp wi
我正在尝试 Angular 2。但是在将 zone.js 作为全局变量导入后出现此错误: 我的包及其版本: "dependencies": { "angular2": "2.0.0-beta.
可能我问这个问题已经太晚了,但无论如何。 有人可以解释一下在什么情况下我需要导入区域的补丁 - zone.js/dist/zone-patch-rxjs。据我所知,补丁已添加到此 PR 中(this
问题很简短:如果我已经在没有时区的时间戳类型的列中有数据,如果我将类型设置为带时区的时间戳,postgresql 将如何处理这些数据? 最佳答案 它将当前值保留在本地时间并将时区设置为本地时间的偏移量
我有一个在东部时区的时间,但我想将它调整为中部时区。两个时区都在美国。我从来没有这样做过?我不知道如何转换它。请帮帮我好吗? 最佳答案 这是一种可能的方法: $dt = new DateTime('2
我在 Angular 11 上有一个应用程序刚刚开始在所有浏览器、所有环境(本地/暂存/生产)上同时出现错误(大约一个小时前,没有任何更新或任何东西): Uncaught TypeError: t.g
我们有一个函数,可以像 JS 一样解析 UTC 中的日期/时间对,但随后强制它的行为就像在本地时区中指定的一样。如下: var tz = (new Date()).toString().match(/
我很难理解 "AT TIME ZONE 'localtime'" 究竟是如何工作的?通过使用它,我发现它的行为与 "AT TIME ZONE 'UTC'" 完全一样......但是为什么呢? "loc
我在 PostgreSQL 9.3 ALTER TABLE manual page 中找到了这个 ALTER COLUMN 语句: ALTER TABLE audits ALTER COLUM
首先,我意识到不推荐使用 time with time zone。我要使用它是因为我将多个 time with time zone 值与我当前的系统时间进行比较,而不管是哪一天。 IE。用户说每天 0
在 Rails 控制台中: > ActiveSupport::TimeZone['Samoa'].utc_offset => -39600 > ActiveSupport::TimeZone['Sam
我在两个不同的数据库中运行了相同的语句:我的本地数据库和 Oracle Live SQL . CREATE TABLE test( timestamp TIMESTAMP DEFAULT SY
我在两个不同的数据库中运行了相同的语句:我的本地数据库和 Oracle Live SQL . CREATE TABLE test( timestamp TIMESTAMP DEFAULT SY
在 Rails 3.0.10 中,我使用 Time.zone 来更改用户查看美国各地发布的类(class)时间的方式。然而,更改时区似乎并不像我期望的那样 Time.zone = TZInfo::Ti
我是一名优秀的程序员,十分优秀!