"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "hsqldb/src/org/hsqldb/types/DateTimeType.java" between
hsqldb-2.7.1.zip and hsqldb-2.7.2.zip

About: HSQLDB (HyperSQL DataBase) is a SQL relational database engine written in Java. It supports nearly full ANSI-92 SQL (BNF format) and full core SQL:2008.

DateTimeType.java  (hsqldb-2.7.1):DateTimeType.java  (hsqldb-2.7.2)
/* Copyright (c) 2001-2022, The HSQL Development Group /* Copyright (c) 2001-2023, The HSQL Development Group
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* *
* Redistributions of source code must retain the above copyright notice, this * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer. * list of conditions and the following disclaimer.
* *
* Redistributions in binary form must reproduce the above copyright notice, * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
skipping to change at line 67 skipping to change at line 67
import org.hsqldb.Tokens; import org.hsqldb.Tokens;
import org.hsqldb.error.Error; import org.hsqldb.error.Error;
import org.hsqldb.error.ErrorCode; import org.hsqldb.error.ErrorCode;
import org.hsqldb.lib.HashSet; import org.hsqldb.lib.HashSet;
import org.hsqldb.lib.StringConverter; import org.hsqldb.lib.StringConverter;
/** /**
* Type subclass for DATE, TIME and TIMESTAMP.<p> * Type subclass for DATE, TIME and TIMESTAMP.<p>
* *
* @author Fred Toussi (fredt@users dot sourceforge.net) * @author Fred Toussi (fredt@users dot sourceforge.net)
* @version 2.7.0 * @version 2.7.2
* @since 1.9.0 * @since 1.9.0
*/ */
public final class DateTimeType extends DTIType { public final class DateTimeType extends DTIType {
public static final long epochSeconds = public static final long epochSeconds =
HsqlDateTime.getDateSeconds("1-01-01"); HsqlDateTime.getDateSeconds("1-01-01");
public static final TimestampData epochTimestamp = public static final TimestampData epochTimestamp =
new TimestampData(epochSeconds); new TimestampData(epochSeconds);
public static final long epochLimitSeconds = public static final long epochLimitSeconds =
HsqlDateTime.getDateSeconds("10000-01-01"); HsqlDateTime.getDateSeconds("10000-01-01");
skipping to change at line 2872 skipping to change at line 2872
zoneSeconds = getZoneSeconds(seconds, zoneSeconds = getZoneSeconds(seconds,
session.getCalendar().getTimeZone()); session.getCalendar().getTimeZone());
} }
ZoneOffset zone = ZoneOffset.ofTotalSeconds(zoneSeconds); ZoneOffset zone = ZoneOffset.ofTotalSeconds(zoneSeconds);
LocalDateTime lt = toLocalDateTime(session, v); LocalDateTime lt = toLocalDateTime(session, v);
return OffsetDateTime.of(lt, zone); return OffsetDateTime.of(lt, zone);
} }
static String convertJavaDateTimeObjectToString(Object a) {
switch(a.getClass().getName()){
case "java.time.LocalDate":
case "java.time.LocalTime":
return a.toString();
case "java.time.LocalDateTime":
case "java.time.OffsetDateTime":
case "java.time.OffsetTime":
return a.toString().replace('T', ' ');
}
return null;
}
//#else //#else
/* /*
public static TimestampData newCurrentTimestamp(TimeZone zone) { public static TimestampData newCurrentTimestamp(TimeZone zone) {
long millis = System.currentTimeMillis(); long millis = System.currentTimeMillis();
long seconds = millis / millisInSecond; long seconds = millis / millisInSecond;
int nanos = (int) (millis % millisInSecond * nanosInMilli); int nanos = (int) (millis % millisInSecond * nanosInMilli);
int zoneSeconds = zone.getOffset(millis) / (int) millisInSecond; int zoneSeconds = zone.getOffset(millis) / (int) millisInSecond;
return new TimestampData(seconds, nanos, zoneSeconds); return new TimestampData(seconds, nanos, zoneSeconds);
} }
public static TimestampData newSystemTimestampUTC() { public static TimestampData newSystemTimestampUTC() {
long millis = System.currentTimeMillis(); long millis = System.currentTimeMillis();
long seconds = millis / millisInSecond; long seconds = millis / millisInSecond;
int nanos = (int) (millis % millisInSecond * nanosInMilli); int nanos = (int) (millis % millisInSecond * nanosInMilli);
return new TimestampData(seconds, nanos); return new TimestampData(seconds, nanos);
} }
static String convertJavaDateTimeObjectToString(Object a) {
return null;
}
*/ */
//#endif JAVA8 //#endif JAVA8
} }
 End of changes. 4 change blocks. 
2 lines changed or deleted 21 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)