use of org.joda.time.LocalTime in project cayenne by apache.
the class JodaModuleIT method testJodaLocalTime.
@Test
public void testJodaLocalTime() {
ObjectContext context = runtime.newContext();
LocalTimeTestEntity localTimeTestEntity = context.newObject(LocalTimeTestEntity.class);
LocalTime localTime = LocalTime.now();
localTimeTestEntity.setTime(localTime);
context.commitChanges();
LocalTimeTestEntity testRead = ObjectSelect.query(LocalTimeTestEntity.class).selectOne(context);
LocalTime time = testRead.getTime();
assertNotNull(time);
assertEquals(LocalTime.class, time.getClass());
assertEquals(localTime.getSecondOfMinute(), time.getSecondOfMinute());
assertEquals(localTime.getMinuteOfHour(), time.getMinuteOfHour());
assertEquals(localTime.getHourOfDay(), time.getHourOfDay());
}
use of org.joda.time.LocalTime in project cayenne by apache.
the class LocalTimeTypeTest method testMaterializeObjectTime.
public void testMaterializeObjectTime() throws Exception {
Object o = type.materializeObject(resultSet(new Time(0)), 1, Types.TIME);
assertEquals(new LocalTime(0), o);
}
use of org.joda.time.LocalTime in project beam by apache.
the class CivilTimeEncoder method decodePacked32TimeSeconds.
/**
* Decodes {@code bitFieldTimeSeconds} as a {@link LocalTime} with seconds precision.
*
* <p>Encoding is as the following:
*
* <pre>
* 3 2 1
* MSB 10987654321098765432109876543210 LSB
* | H || M || S |
* </pre>
*
* @see #encodePacked32TimeSeconds(LocalTime)
* @see #encodePacked32TimeSecondsAsJavaTime(int)
*/
// should return a java.time.LocalTime
@SuppressWarnings("GoodTime")
public static LocalTime decodePacked32TimeSeconds(int bitFieldTimeSeconds) {
checkValidBitField(bitFieldTimeSeconds, TIME_SECONDS_MASK);
int hourOfDay = getFieldFromBitField(bitFieldTimeSeconds, HOUR_MASK, HOUR_SHIFT);
int minuteOfHour = getFieldFromBitField(bitFieldTimeSeconds, MINUTE_MASK, MINUTE_SHIFT);
int secondOfMinute = getFieldFromBitField(bitFieldTimeSeconds, SECOND_MASK, SECOND_SHIFT);
LocalTime time = new LocalTime(hourOfDay, minuteOfHour, secondOfMinute);
checkValidTimeSeconds(time);
return time;
}
use of org.joda.time.LocalTime in project Auto.js by hyb1996.
the class TimedTaskSettingActivity method createDisposableTask.
private TimedTask createDisposableTask() {
LocalTime time = TIME_FORMATTER.parseLocalTime(mDisposableTaskTime.getText().toString());
LocalDate date = DATE_FORMATTER.parseLocalDate(mDisposableTaskDate.getText().toString());
LocalDateTime dateTime = new LocalDateTime(date.getYear(), date.getMonthOfYear(), date.getDayOfMonth(), time.getHourOfDay(), time.getMinuteOfHour());
if (dateTime.isBefore(LocalDateTime.now())) {
Toast.makeText(this, R.string.text_disposable_task_time_before_now, Toast.LENGTH_SHORT).show();
return null;
}
return TimedTask.disposableTask(dateTime, mScriptFile.getPath(), ExecutionConfig.getDefault());
}
use of org.joda.time.LocalTime in project java-driver by datastax.
the class LocalTimeCodecTest method should_parse_valid_formats.
@Test(groups = "unit", dataProvider = "LocalTimeCodecTest.parse")
public void should_parse_valid_formats(String input, LocalTime expected) {
// when
LocalTime actual = LocalTimeCodec.instance.parse(input);
// then
assertThat(actual).isEqualTo(expected);
}
Aggregations