我正在尝试使用 Lotus Java/CORBA 类在任意时区创建 Domino DateTime 对象。
对于具有整数小时数的基本偏移量的所有时区,我似乎都是成功的。对于分数时区,尤其是像伊朗、印度和斯里兰卡这样的半小时时区,或者更不常见的时区,比如 45 分钟偏移的尼泊尔。我最终返回了一个重新计算为整数时区的 DateTime,因此尝试在伊朗时区(+03:30 和 1 小时 DST)请求 18:45 给我一个代表 18:45 的 DateTime +03:00 偏移量。
这给我带来了很大的麻烦,因为它实际上改变了表示的瞬间,并且导致当将此日期写入约会时,Notes 客户端向用户解释日期是如何在不同时区写入的。
Notes 本身在提供的时区中编写约会没有问题,尽管它当然是通过与我使用的连接不同的连接来完成的。
至于细节,我目前使用的是 Domino 8.5.1 和一个匹配的客户端,并且已经使用几个不同版本的 NCSO.jar 文件验证了这个问题。
Java/CORBA 类只提供了三种创建日期的方法,它们都在会话对象上。只有其中一种方法被记录为时区感知(接受 java.util.Calendar 对象)。我知道没有其他方法可以创建更新多米诺时间/日期时间字段所需的日期时间。
记录 DIIOP 连接仅产生方法调用模式,在下面详细介绍 DateTime 创建的摘录中重现。
先决条件是一个名为“会话”的开放多米诺会话对象。该会话用于此示例的目的,该示例位于珀斯,UTC+08:00,以消除它作为倾斜时间分量的来源。
如果有人在 Domino 中使用 Java/CORBA 库,我会特别感兴趣,他们是否遇到过类似的问题,以及采取了哪些措施来纠正这个问题。或者,我仍然不了解有关相关方法的任何信息。
// first block creates a Calendar for 2010-07-21T10:15:00 in the Iran time zone.
// so far, nothing domino specific. The resulting calendar is verified as correct.
TimeZone tz = TimeZone.getTimeZone("Asia/Tehran");
Calendar calendar = Calendar.getInstance(tz);
calendar.setTimeZone(tz);
calendar.set(2010, 6, 21, 10, 15, 0);
// first call
DateTime result = session.createDateTime(calendar);
// second call
System.out.println(result.getTimeZone());
// third call
System.out.println(result.getZoneTime());
上述代码的输出和跟踪:
first call to Domino produces the following DIIOP trace
2010-07-12 23:22:28 DIIOP Session SN000472537: Executing createDateTimeObject
2010-07-12 23:22:28 DIIOP Session SN000472537: Executing setZoneDateTimeFromJava
2010-07-12 23:22:29 DIIOP Session SN000472537: Executing getDateTime
second call to Domino, on the resulting DateTime object to retrieve the integer offset. We expect -3003, which is how Domino encodes 03:30 east of the prime meridian. Instead we recieve -3, which encodes 03:00 east of the prime meridian.
second call to Domino produces the following trace
2010-07-12 23:22:58 DIIOP Session SN000472537: Executing getDateTime
second call produces the following stdout output
-3
third call to Domino to retrieve the printable time as Domino knows it.
third call produces the following DIIOP trace.
2010-07-12 23:23:14 DIIOP Session SN000472537: Executing getZoneTime
2010-07-12 23:23:14 DIIOP Session SN000472537: Executing getDateTime
third call results in the following stdout output 2010-07-21 10:15:00 ZE3
为了澄清“ZE3”时区,Domino 使用此格式作为一般时区,并将其读作“Zone East(positive)offset 03:00”。A、B 或 C 将作为 15、30 或 45 分钟偏移的后缀。因此,预期的偏移量 +03:30 应该会导致“ZE3B”区域中的日期,但不幸的是没有。