Java Code Examples for java.time.OffsetTime#withOffsetSameInstant()
The following examples show how to use
java.time.OffsetTime#withOffsetSameInstant() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OffsetTimeParameter.java From mariadb-connector-j with GNU Lesser General Public License v2.1 | 5 votes |
/** * Constructor. * * @param offsetTime time with offset * @param serverZoneId server session zoneId * @param fractionalSeconds must fractional Seconds be send to database. * @param options session options * @throws SQLException if offset cannot be converted to server offset */ public OffsetTimeParameter( OffsetTime offsetTime, ZoneId serverZoneId, boolean fractionalSeconds, Options options) throws SQLException { ZoneId zoneId = options.useLegacyDatetimeCode ? ZoneOffset.systemDefault() : serverZoneId; if (zoneId instanceof ZoneOffset) { throw new SQLException( "cannot set OffsetTime, since server time zone is set to '" + serverZoneId.toString() + "' (check server variables time_zone and system_time_zone)"); } this.time = offsetTime.withOffsetSameInstant((ZoneOffset) zoneId); this.fractionalSeconds = fractionalSeconds; }
Example 2
Source File: TCKOffsetTime.java From hottub with GNU General Public License v2.0 | 5 votes |
@Test public void test_withOffsetSameInstant() { OffsetTime base = OffsetTime.of(11, 30, 59, 0, OFFSET_PONE); OffsetTime test = base.withOffsetSameInstant(OFFSET_PTWO); OffsetTime expected = OffsetTime.of(12, 30, 59, 0, OFFSET_PTWO); assertEquals(test, expected); }
Example 3
Source File: TCKOffsetTime.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@Test public void test_withOffsetSameInstant() { OffsetTime base = OffsetTime.of(11, 30, 59, 0, OFFSET_PONE); OffsetTime test = base.withOffsetSameInstant(OFFSET_PTWO); OffsetTime expected = OffsetTime.of(12, 30, 59, 0, OFFSET_PTWO); assertEquals(test, expected); }
Example 4
Source File: TCKOffsetTime.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@Test public void test_withOffsetSameInstant() { OffsetTime base = OffsetTime.of(11, 30, 59, 0, OFFSET_PONE); OffsetTime test = base.withOffsetSameInstant(OFFSET_PTWO); OffsetTime expected = OffsetTime.of(12, 30, 59, 0, OFFSET_PTWO); assertEquals(test, expected); }
Example 5
Source File: TCKOffsetTime.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
@Test public void test_withOffsetSameInstant() { OffsetTime base = OffsetTime.of(11, 30, 59, 0, OFFSET_PONE); OffsetTime test = base.withOffsetSameInstant(OFFSET_PTWO); OffsetTime expected = OffsetTime.of(12, 30, 59, 0, OFFSET_PTWO); assertEquals(test, expected); }
Example 6
Source File: TCKOffsetTime.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Test public void test_withOffsetSameInstant() { OffsetTime base = OffsetTime.of(11, 30, 59, 0, OFFSET_PONE); OffsetTime test = base.withOffsetSameInstant(OFFSET_PTWO); OffsetTime expected = OffsetTime.of(12, 30, 59, 0, OFFSET_PTWO); assertEquals(test, expected); }
Example 7
Source File: TCKOffsetTime.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions=NullPointerException.class) public void test_withOffsetSameInstant_null() { OffsetTime base = OffsetTime.of(11, 30, 59, 0, OFFSET_PONE); base.withOffsetSameInstant(null); }
Example 8
Source File: TCKOffsetTime.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions=NullPointerException.class) public void test_withOffsetSameInstant_null() { OffsetTime base = OffsetTime.of(11, 30, 59, 0, OFFSET_PONE); base.withOffsetSameInstant(null); }
Example 9
Source File: TCKOffsetTime.java From j2objc with Apache License 2.0 | 4 votes |
@Test(expected=NullPointerException.class) public void test_withOffsetSameInstant_null() { OffsetTime base = OffsetTime.of(11, 30, 59, 0, OFFSET_PONE); base.withOffsetSameInstant(null); }
Example 10
Source File: TCKOffsetTime.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
@Test public void test_withOffsetSameInstant_noChange() { OffsetTime base = OffsetTime.of(11, 30, 59, 0, OFFSET_PONE); OffsetTime test = base.withOffsetSameInstant(OFFSET_PONE); assertEquals(test, base); }
Example 11
Source File: TCKOffsetTime.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions=NullPointerException.class) public void test_withOffsetSameInstant_null() { OffsetTime base = OffsetTime.of(11, 30, 59, 0, OFFSET_PONE); base.withOffsetSameInstant(null); }
Example 12
Source File: TCKOffsetTime.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions=NullPointerException.class) public void test_withOffsetSameInstant_null() { OffsetTime base = OffsetTime.of(11, 30, 59, 0, OFFSET_PONE); base.withOffsetSameInstant(null); }
Example 13
Source File: TCKOffsetTime.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
@Test public void test_withOffsetSameInstant_noChange() { OffsetTime base = OffsetTime.of(11, 30, 59, 0, OFFSET_PONE); OffsetTime test = base.withOffsetSameInstant(OFFSET_PONE); assertEquals(test, base); }
Example 14
Source File: TCKOffsetTime.java From hottub with GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions=NullPointerException.class) public void test_withOffsetSameInstant_null() { OffsetTime base = OffsetTime.of(11, 30, 59, 0, OFFSET_PONE); base.withOffsetSameInstant(null); }
Example 15
Source File: TCKOffsetTime.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
@Test public void test_withOffsetSameInstant_noChange() { OffsetTime base = OffsetTime.of(11, 30, 59, 0, OFFSET_PONE); OffsetTime test = base.withOffsetSameInstant(OFFSET_PONE); assertEquals(test, base); }
Example 16
Source File: TCKOffsetTime.java From hottub with GNU General Public License v2.0 | 4 votes |
@Test public void test_withOffsetSameInstant_noChange() { OffsetTime base = OffsetTime.of(11, 30, 59, 0, OFFSET_PONE); OffsetTime test = base.withOffsetSameInstant(OFFSET_PONE); assertEquals(test, base); }
Example 17
Source File: TCKOffsetTime.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions=NullPointerException.class) public void test_withOffsetSameInstant_null() { OffsetTime base = OffsetTime.of(11, 30, 59, 0, OFFSET_PONE); base.withOffsetSameInstant(null); }
Example 18
Source File: TCKOffsetTime.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions=NullPointerException.class) public void test_withOffsetSameInstant_null() { OffsetTime base = OffsetTime.of(11, 30, 59, 0, OFFSET_PONE); base.withOffsetSameInstant(null); }
Example 19
Source File: TCKOffsetTime.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
@Test public void test_withOffsetSameInstant_noChange() { OffsetTime base = OffsetTime.of(11, 30, 59, 0, OFFSET_PONE); OffsetTime test = base.withOffsetSameInstant(OFFSET_PONE); assertEquals(test, base); }
Example 20
Source File: FreezeTransaction.java From hedera-sdk-java with Apache License 2.0 | 3 votes |
/** * Set the end time (hour and minute) of the freeze. * * The time will be converted to UTC if it isn't already. Take note that both start and end * times are assumed to fall on the same day in Coordinated Universal Time. * * @param endTime the end time of the freeze (down to the minute), before conversion to UTC. * @return {@code this} for fluent usage. */ public FreezeTransaction setEndTime(OffsetTime endTime) { OffsetTime actual = endTime.withOffsetSameInstant(ZoneOffset.UTC); builder.setEndHour(actual.getHour()); builder.setEndMin(actual.getMinute()); return this; }