commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jayakumar T (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (NET-403) file.getTimestamp(); showing a difference of TIME ZONE RAWOFFSET
Date Thu, 21 Apr 2011 06:27:05 GMT

    [ https://issues.apache.org/jira/browse/NET-403?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13022630#comment-13022630
] 

Jayakumar T commented on NET-403:
---------------------------------

There is another one issue also, While running from US server it is getting a difference of
a Year

>From India I created a file inside the ftp server which is in CDT(Central Daylight Time)
 On 4/21/2011 10:59 INDIAN TIME

{code} 
log.info("FTP FILE: "+file.toString());

log.info("FTP DATE: "+fileTime.getTime().toString());
log.info("LOCAL DATE: "+calendar.getTime().toString());

log.info("FTP TIME ZONE: "+fileTime.getTimeZone().getDisplayName());
log.info("LOCAL TIME ZONE: "+calendar.getTimeZone().getDisplayName());

log.info("FTP ZONE_OFFSET: " +fileTime.get(Calendar.ZONE_OFFSET));
log.info("LOCAL ZONE_OFFSET: " +calendar.get(Calendar.ZONE_OFFSET));

log.info("FTP Calendar: " +fileTime.toString());
log.info("LOCAL Calendar: " +calendar.toString());

log.info("FTP TimeInMillis: " +fileTime.getTimeInMillis());
log.info("LOCAL TimeInMillis: " +calendar.getTimeInMillis());

log.info("FTP YEAR: " +fileTime.get(Calendar.YEAR));
log.info("LOCAL YEAR: " +calendar.get(Calendar.YEAR));

log.info("FTP DAY_OF_WEEK: " +fileTime.get(Calendar.DAY_OF_WEEK));
log.info("LOCAL DAY_OF_WEEK: " +calendar.get(Calendar.DAY_OF_WEEK));

log.info("FTP HOURS: " +fileTime.get(Calendar.HOUR_OF_DAY));
log.info("LOCAL HOURS: " +calendar.get(Calendar.HOUR_OF_DAY));

log.info("FTP MINUTE: " +fileTime.get(Calendar.MINUTE));
log.info("LOCAL MINUTE: " +calendar.get(Calendar.MINUTE));

{code} 




1.Running program from INDIA on 21 Apr 2011 11:00:01 INDIAN TIME
{code} 
21 Apr 2011 11:00:03 - FTP FILE: -rw-r--r--    1 506      506             0 Apr 21 05:29 New
Bitmap Image.bmp
21 Apr 2011 11:00:03 - FTP DATE: Thu Apr 21 05:29:00 IST 2011
21 Apr 2011 11:00:03 - LOCAL DATE: Thu Apr 21 09:59:59 IST 2011
21 Apr 2011 11:00:03 - FTP TIME ZONE: India Standard Time
21 Apr 2011 11:00:03 - LOCAL TIME ZONE: India Standard Time
21 Apr 2011 11:00:03 - FTP ZONE_OFFSET: 19800000
21 Apr 2011 11:00:03 - LOCAL ZONE_OFFSET: 19800000
21 Apr 2011 11:00:03 - FTP Calendar: java.util.GregorianCalendar[time=1303343940000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Asia/Calcutta",offset=19800000,dstSavings=0,useDaylight=false,transitions=6,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2011,MONTH=3,WEEK_OF_YEAR=17,WEEK_OF_MONTH=4,DAY_OF_MONTH=21,DAY_OF_YEAR=111,DAY_OF_WEEK=5,DAY_OF_WEEK_IN_MONTH=3,AM_PM=0,HOUR=5,HOUR_OF_DAY=5,MINUTE=29,SECOND=0,MILLISECOND=0,ZONE_OFFSET=19800000,DST_OFFSET=0]
21 Apr 2011 11:00:03 - LOCAL Calendar: java.util.GregorianCalendar[time=1303360199893,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Asia/Calcutta",offset=19800000,dstSavings=0,useDaylight=false,transitions=6,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2011,MONTH=3,WEEK_OF_YEAR=17,WEEK_OF_MONTH=4,DAY_OF_MONTH=21,DAY_OF_YEAR=111,DAY_OF_WEEK=5,DAY_OF_WEEK_IN_MONTH=3,AM_PM=0,HOUR=9,HOUR_OF_DAY=9,MINUTE=59,SECOND=59,MILLISECOND=893,ZONE_OFFSET=19800000,DST_OFFSET=0]
21 Apr 2011 11:00:03 - FTP TimeInMillis: 1303343940000
21 Apr 2011 11:00:03 - LOCAL TimeInMillis: 1303360199893
21 Apr 2011 11:00:03 - FTP YEAR: 2011
21 Apr 2011 11:00:03 - LOCAL YEAR: 2011
21 Apr 2011 11:00:03 - FTP DAY_OF_WEEK: 5
21 Apr 2011 11:00:03 - LOCAL DAY_OF_WEEK: 5
21 Apr 2011 11:00:03 - FTP HOURS: 5
21 Apr 2011 11:00:03 - LOCAL HOURS: 9
21 Apr 2011 11:00:03 - FTP MINUTE: 29
21 Apr 2011 11:00:03 - LOCAL MINUTE: 59
{code} 

2. Running program from US on 21 Apr 2011 11:01:01 INDIAN TIME
{code} 
20 Apr 2011 23:50:33 - FTP FILE: -rw-r--r--    1 506      506             0 Apr 21 05:29 New
Bitmap Image.bmp
20 Apr 2011 23:50:33 - FTP DATE: Wed Apr 21 05:29:00 GMT-06:00 2010
20 Apr 2011 23:50:33 - LOCAL DATE: Wed Apr 20 22:50:32 GMT-06:00 2011
20 Apr 2011 23:50:33 - FTP TIME ZONE: GMT-06:00
20 Apr 2011 23:50:33 - LOCAL TIME ZONE: GMT-06:00
20 Apr 2011 23:50:33 - FTP ZONE_OFFSET: -21600000
20 Apr 2011 23:50:33 - LOCAL ZONE_OFFSET: -21600000
20 Apr 2011 23:50:33 - FTP Calendar: java.util.GregorianCalendar[time=1271849340000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="GMT-06:00",offset=-21600000,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2010,MONTH=3,WEEK_OF_YEAR=17,WEEK_OF_MONTH=4,DAY_OF_MONTH=21,DAY_OF_YEAR=111,DAY_OF_WEEK=4,DAY_OF_WEEK_IN_MONTH=3,AM_PM=0,HOUR=5,HOUR_OF_DAY=5,MINUTE=29,SECOND=0,MILLISECOND=0,ZONE_OFFSET=-21600000,DST_OFFSET=0]
20 Apr 2011 23:50:33 - LOCAL Calendar: java.util.GregorianCalendar[time=1303361432937,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="GMT-06:00",offset=-21600000,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2011,MONTH=3,WEEK_OF_YEAR=17,WEEK_OF_MONTH=4,DAY_OF_MONTH=20,DAY_OF_YEAR=110,DAY_OF_WEEK=4,DAY_OF_WEEK_IN_MONTH=3,AM_PM=1,HOUR=10,HOUR_OF_DAY=22,MINUTE=50,SECOND=32,MILLISECOND=937,ZONE_OFFSET=-21600000,DST_OFFSET=0]
20 Apr 2011 23:50:33 - FTP TimeInMillis: 1271849340000
20 Apr 2011 23:50:33 - LOCAL TimeInMillis: 1303361432937
20 Apr 2011 23:50:33 - FTP YEAR: 2010
20 Apr 2011 23:50:33 - LOCAL YEAR: 2011
20 Apr 2011 23:50:33 - FTP DAY_OF_WEEK: 4
20 Apr 2011 23:50:33 - LOCAL DAY_OF_WEEK: 4
20 Apr 2011 23:50:33 - FTP HOURS: 5
20 Apr 2011 23:50:33 - LOCAL HOURS: 22
20 Apr 2011 23:50:33 - FTP MINUTE: 29
20 Apr 2011 23:50:33 - LOCAL MINUTE: 50
{code} 



> file.getTimestamp(); showing a difference of TIME ZONE RAWOFFSET
> ----------------------------------------------------------------
>
>                 Key: NET-403
>                 URL: https://issues.apache.org/jira/browse/NET-403
>             Project: Commons Net
>          Issue Type: Bug
>          Components: FTP
>    Affects Versions: 2.0, 2.2
>         Environment: JDK 1.5, commons-net-2.2
>            Reporter: Jayakumar T
>
> After Connecting an FTP server in the Same Timezone, Date And Time, I created a File
and run the program shown below to get the created or modified time of that file.
> But, file.getTimestamp(); is showing a difference of TIME ZONE RAWOFFSET between local
time and File Creation time. Please see the logs below.
> {code}
> Calendar calendar = Calendar.getInstance();
> FTPFile[] payoutFiles = ftp.listFiles();
> 			
> 			
> if(payoutFiles!=null)
> {
>     for (FTPFile file : payoutFiles) {
>     Calendar fileTime=file.getTimestamp();
>     
>      log.info("FTP TIME ZONE: "+fileTime.getTimeZone().getDisplayName());
>      log.info("LOCAL TIME ZONE: "+calendar.getTimeZone().getDisplayName());
>      
>      log.info("FTP ZONE_OFFSET: " +fileTime.get(Calendar.ZONE_OFFSET));
>      log.info("LOCAL ZONE_OFFSET: " +calendar.get(Calendar.ZONE_OFFSET));
> 					
>      log.info("FTP TIME: " +fileTime.toString());
>      log.info("LOCAL TIME: " +calendar.toString());
> 					
>      log.info("FTP TIME: " +fileTime.getTimeInMillis());
>      log.info("LOCAL TIME: " +calendar.getTimeInMillis());
> 					
>      log.info("FTP HOUR: " +fileTime.get(Calendar.HOUR_OF_DAY));
>      log.info("LOCAL HOUR: " +calendar.get(Calendar.HOUR_OF_DAY));
> 					
>      log.info("FTP MINUTE: " +fileTime.get(Calendar.MINUTE));
>      log.info("LOCAL MINUTE: " +calendar.get(Calendar.MINUTE));
> }
> {code}
> GETTING OUTPUT
> {noformat}
> [INFO,CheckFTP,main] FTP TIME ZONE: India Standard Time
> [INFO,CheckFTP,main] LOCAL TIME ZONE: India Standard Time
> [INFO,CheckFTP,main] FTP ZONE_OFFSET: 19800000
> [INFO,CheckFTP,main] LOCAL ZONE_OFFSET: 19800000
> [INFO,CheckFTP,main] FTP TIME: java.util.GregorianCalendar[time=1302151140000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Asia/Calcutta",offset=19800000,dstSavings=0,useDaylight=false,transitions=6,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2011,MONTH=3,WEEK_OF_YEAR=15,WEEK_OF_MONTH=2,DAY_OF_MONTH=7,DAY_OF_YEAR=97,DAY_OF_WEEK=5,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=10,HOUR_OF_DAY=10,MINUTE=9,SECOND=0,MILLISECOND=0,ZONE_OFFSET=19800000,DST_OFFSET=0]
> [INFO,CheckFTP,main] LOCAL TIME: java.util.GregorianCalendar[time=1302173106873,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Asia/Calcutta",offset=19800000,dstSavings=0,useDaylight=false,transitions=6,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2011,MONTH=3,WEEK_OF_YEAR=15,WEEK_OF_MONTH=2,DAY_OF_MONTH=7,DAY_OF_YEAR=97,DAY_OF_WEEK=5,DAY_OF_WEEK_IN_MONTH=1,AM_PM=1,HOUR=4,HOUR_OF_DAY=16,MINUTE=15,SECOND=6,MILLISECOND=873,ZONE_OFFSET=19800000,DST_OFFSET=0]
> [INFO,CheckFTP,main] FTP TIME: 1302151140000
> [INFO,CheckFTP,main] LOCAL TIME: 1302173106873
> [INFO,CheckFTP,main] FTP HOURS: 10
> [INFO,CheckFTP,main] LOCAL HOURS: 16
> [INFO,CheckFTP,main] FTP MINUTE: 9
> [INFO,CheckFTP,main] LOCAL MINUTE: 15
> {noformat}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message