Project

Profile

Help

fn:implicit-timezone() - no DST

Added by Anonymous over 14 years ago

Legacy ID: #8176091 Legacy Poster: David Lee (daldei)

XPath specs are very vague on what fn:implicit-timezone() is supposed to return, but my reading of the intent is it should return the local timezone from the environment of whatever launches saxon. Otherwise it would be useless (and should return 0). Running on both linux and windows it appears to not adjust for DST, atleast today. $ date +%z -0400 $ echo -- <[ fn:implicit-timezone() ]> -PT5H Possibly saxon is calculating DST flag itself and hasn't been updated to local recent changes ? Or perhaps TimeZone is being used without the DST adjustment ? print( TimeZone.getDefault().getDSTSavings() ); 3600000 -David Lee


Replies (3)

Please register to reply

RE: fn:implicit-timezone() - no DST - Added by Anonymous over 14 years ago

Legacy ID: #8176107 Legacy Poster: David Lee (daldei)

FYI, I found fn:current-DateTime is using the correct timezone on windows --- Windows: correct echo <[ fn:current-dateTime() ]> 2010-03-18T08:25:39.087-04:00 $ date Thu Mar 18 08:25:42 EDT 2010 ---- Linux - Incorrect But the incorrect timezone and time on Linux $ echo <[ fn:current-dateTime() ]> 2010-03-18T07:26:56.691-05:00 $ date Thu Mar 18 08:27:19 EDT 2010

RE: fn:implicit-timezone() - no DST - Added by Anonymous over 14 years ago

Legacy ID: #8177039 Legacy Poster: Michael Kay (mhkay)

Saxon is dependent on the Java VM for timezone information. Are you sure your Java VM is up to date? What output do you get from this, which is simply a way of calling GregorianCalendar.new(), on both your machines?: java net.sf.saxon.Query -qs:"" (Sorry, if you haven't got a version that runs extension functions, you'll have to do write/compile the Java code directly)

RE: fn:implicit-timezone() - no DST - Added by Anonymous over 14 years ago

Legacy ID: #8177132 Legacy Poster: David Lee (daldei)

Thanks! You are right, there is something wrong with Java time on my linux but not my windows system. This link seems to find this bug as well http://www.minaret.biz/tips/timezone.html For completeness, this java program: class TimeTest { public static void main(String[] args) { System.out.println( (new java.util.Date()).toString() ); System.out.println( (new java.util.GregorianCalendar()).toString() ); System.out.println( (java.util.TimeZone.getDefault()).getDSTSavings() ); } } ------ Windows Thu Mar 18 13:28:20 EDT 2010 java.util.GregorianCalendar[time=1268933300642,areFieldsSet=true,areAllFieldsSet =true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="America/New_York",offset= -18000000,dstSavings=3600000,useDaylight=true,transitions=235,lastRule=java.util .SimpleTimeZone[id=America/New_York,offset=-18000000,dstSavings=3600000,useDayli ght=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startT ime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTim e=7200000,endTimeMode=0]],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2 010,MONTH=2,WEEK_OF_YEAR=12,WEEK_OF_MONTH=3,DAY_OF_MONTH=18,DAY_OF_YEAR=77,DAY_O F_WEEK=5,DAY_OF_WEEK_IN_MONTH=3,AM_PM=1,HOUR=1,HOUR_OF_DAY=13,MINUTE=28,SECOND=2 0,MILLISECOND=642,ZONE_OFFSET=-18000000,DST_OFFSET=3600000] 3600000 --------- Linux Thu Mar 18 12:28:43 CDT 2010 java.util.GregorianCalendar[time=1268933323106,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="America/Chicago",offset=-21600000,dstSavings=3600000,useDaylight=true,transitions=235,lastRule=java.util.SimpleTimeZone[id=America/Chicago,offset=-21600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2010,MONTH=2,WEEK_OF_YEAR=12,WEEK_OF_MONTH=3,DAY_OF_MONTH=18,DAY_OF_YEAR=77,DAY_OF_WEEK=5,DAY_OF_WEEK_IN_MONTH=3,AM_PM=1,HOUR=0,HOUR_OF_DAY=12,MINUTE=28,SECOND=43,MILLISECOND=106,ZONE_OFFSET=-21600000,DST_OFFSET=3600000] 3600000 But manually forcing the timezone by running java -Duser.timezone=US/Eastern -cp . TimeTest Thu Mar 18 13:29:03 EDT 2010 java.util.GregorianCalendar[time=1268933343332,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="US/Eastern",offset=-18000000,dstSavings=3600000,useDaylight=true,transitions=235,lastRule=java.util.SimpleTimeZone[id=US/Eastern,offset=-18000000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2010,MONTH=2,WEEK_OF_YEAR=12,WEEK_OF_MONTH=3,DAY_OF_MONTH=18,DAY_OF_YEAR=77,DAY_OF_WEEK=5,DAY_OF_WEEK_IN_MONTH=3,AM_PM=1,HOUR=1,HOUR_OF_DAY=13,MINUTE=29,SECOND=3,MILLISECOND=332,ZONE_OFFSET=-18000000,DST_OFFSET=3600000] 3600000 And then running Saxon with this same setting fn:implicit-timezone() produces the correct "-PT4H" instead of "-PT5H" Sorry for the trouble, -David

    (1-3/3)

    Please register to reply