Skip to content

Commit

Permalink
DBTimeZone renamed to TimeZone (#1660)
Browse files Browse the repository at this point in the history
  • Loading branch information
chipkent authored Dec 8, 2021
1 parent d20d930 commit 5e17bed
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import wrapt


_java_type_ = None # None until the first define_symbols() call
DBTimeZone = None #: Deephaven timezone class (io.deephaven.time.TimeZone).
TimeZone = None #: Deephaven timezone class (io.deephaven.time.TimeZone).
DateTime = None #: Deephaven date-time class (io.deephaven.time.DateTime).
Period = None #: Deephaven time period class (io.deephaven.time.Period).

Expand All @@ -41,12 +41,12 @@ def _defineSymbols():
if not jpy.has_jvm():
raise SystemError("No java functionality can be used until the JVM has been initialized through the jpy module")

global _java_type_, DBTimeZone, DateTime, Period
global _java_type_, TimeZone, DateTime, Period
if _java_type_ is not None:
return
# This will raise an exception if the desired object is not the classpath
_java_type_ = jpy.get_type("io.deephaven.time.DateTimeUtils")
DBTimeZone = jpy.get_type("io.deephaven.time.TimeZone")
TimeZone = jpy.get_type("io.deephaven.time.TimeZone")
DateTime = jpy.get_type("io.deephaven.time.DateTime")
Period = jpy.get_type("io.deephaven.time.Period")

Expand Down
6 changes: 3 additions & 3 deletions Integrations/python/deephaven/DateTimeUtils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@


_java_type_ = None # None until the first define_symbols() call
DBTimeZone = None #: Deephaven timezone class (io.deephaven.time.TimeZone).
TimeZone = None #: Deephaven timezone class (io.deephaven.time.TimeZone).
DateTime = None #: Deephaven date-time class (io.deephaven.time.DateTime).
Period = None #: Deephaven time period class (io.deephaven.time.Period).

Expand All @@ -47,12 +47,12 @@ def _defineSymbols():
if not jpy.has_jvm():
raise SystemError("No java functionality can be used until the JVM has been initialized through the jpy module")

global _java_type_, DBTimeZone, DateTime, Period
global _java_type_, TimeZone, DateTime, Period
if _java_type_ is not None:
return
# This will raise an exception if the desired object is not the classpath
_java_type_ = jpy.get_type("io.deephaven.time.DateTimeUtils")
DBTimeZone = jpy.get_type("io.deephaven.time.TimeZone")
TimeZone = jpy.get_type("io.deephaven.time.TimeZone")
DateTime = jpy.get_type("io.deephaven.time.DateTime")
Period = jpy.get_type("io.deephaven.time.Period")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"setTzDefault": "Set the default time zone.\n\n:param tzDefault: (io.deephaven.time.TimeZone) - the TimeZone to be used as the default.",
"valueOf": "Returns the enum constant of this type with the specified name.\nThe string must match exactly an identifier used to declare an\nenum constant in this type. (Extraneous whitespace characters are \nnot permitted.)\n\n:param name: (java.lang.String) - the name of the enum constant to be returned.\n:return: (io.deephaven.time.TimeZone) the enum constant with the specified name",
"values": "Returns an array containing the constants of this enum type, in\nthe order they are declared.\n\n:return: (io.deephaven.time.TimeZone[]) an array containing the constants of this enum type, in the order they are declared",
"valuesByOffset": "This method returns the same contents as values(), but ordered by geographic location / UTC\n offset. If two elements exist within the same timezone, they are second-order-sorted by name\n\n:return: (io.deephaven.time.TimeZone[]) An array of DBTimeZones ordered by UTC-offset"
"valuesByOffset": "This method returns the same contents as values(), but ordered by geographic location / UTC\n offset. If two elements exist within the same timezone, they are second-order-sorted by name\n\n:return: (io.deephaven.time.TimeZone[]) An array of TimeZones ordered by UTC-offset"
},
"path": "io.deephaven.time.TimeZone",
"text": "Defines Deephaven-supported timezones, which may be used for PQ-scheduling and display purposes",
Expand Down
10 changes: 5 additions & 5 deletions Integrations/python/test/testDateTimeUtil.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ def testTimestampFromDatetime(self):
junk = DateTimeUtils.getExcelDateTime(now)

tz = jpy.get_type('io.deephaven.time.TimeZone').TZ_NY
with self.subTest(msg="getExcelDateTime(DateTime, DbTimeZone)"):
with self.subTest(msg="getExcelDateTime(DateTime, TimeZone)"):
junk = DateTimeUtils.getExcelDateTime(now, tz)
with self.subTest(msg="getExcelDateTime(DateTime, TimeZone)"):
# NB: converting from DbTimeZone to TimeZone - should work...
# NB: converting from TimeZone to TimeZone - should work...
# should we even test this?
junk = DateTimeUtils.getExcelDateTime(now, tz.getTimeZone().toTimeZone())

Expand All @@ -124,7 +124,7 @@ def testZonedMethods(self):
junk = DateTimeUtils.getZonedDateTime(now) # will have TZ_DEFAULT applied

tz = jpy.get_type('io.deephaven.time.TimeZone').TZ_NY
with self.subTest(msg="getZonedDateTime(DateTime, DbTimeZone)"):
with self.subTest(msg="getZonedDateTime(DateTime, TimeZone)"):
zoned = DateTimeUtils.getZonedDateTime(now, tz)
with self.subTest(msg="toDateTime(ZonedDateTime)"):
junk = DateTimeUtils.toDateTime(zoned)
Expand Down Expand Up @@ -280,14 +280,14 @@ def testFormatting(self):

with self.subTest(msg="formatNy(DateTime)"):
junk = DateTimeUtils.formatNy(now) # Eastern timezone format
with self.subTest(msg="format(DateTime, DbTimeZone)"):
with self.subTest(msg="format(DateTime, TimeZone)"):
junk = DateTimeUtils.format(now, tz)
# Unrelated method - formats long as period <days>T<hours>:....
with self.subTest(msg="format(long)"):
junk = DateTimeUtils.format(86400000000000 + 2*3600000000000 + 4*60000000000 + 8*1000000000 + 16)

# Basically aliases of the above - why both?
with self.subTest(msg="formatDate(DateTime, DbTimeZone)"):
with self.subTest(msg="formatDate(DateTime, TimeZone)"):
junk = DateTimeUtils.formatDate(now, tz)
with self.subTest(msg="formatDateNy(DateTime)"):
junk = DateTimeUtils.formatDateNy(now)
Expand Down
2 changes: 1 addition & 1 deletion engine/time/src/main/java/io/deephaven/time/TimeZone.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ private static TimeZone lookupByOffset(DateTimeZone dateTimeZone) {
* This method returns the same contents as {@link TimeZone#values()}, but ordered by geographic location / UTC
* offset. If two elements exist within the same timezone, they are second-order-sorted by name
*
* @return An array of DBTimeZones ordered by UTC-offset
* @return An array of TimeZones ordered by UTC-offset
*/
public static TimeZone[] valuesByOffset() {
final List<TimeZone> allZones = Arrays.asList(values());
Expand Down

0 comments on commit 5e17bed

Please sign in to comment.