[jcifs] Preserve lastModified TIME

Michael B. Allen miallen at eskimo.com
Wed Aug 14 17:01:07 EST 2002


On Wed, 14 Aug 2002 01:49:35 -0400
"Allen, Michael B (RSCH)" <Michael_B_Allen at ml.com> wrote:

> First, please send these messages to the list.
> 
> > -----Original Message-----
> > From:	andy chernow [SMTP:achernow at yahoo.com]
> > Sent:	Wednesday, August 14, 2002 1:43 AM
> > To:	Allen, Michael B (RSCH)
> > Subject:	RE: [jcifs] Preserve lastModified TIME
> > 
> > That worked.  For testing I just modified line 35 in
> > SmbComClose, 
> > from: lastWriteTime = 0xFFFFFFFF; 
> > to:   lastWriteTime = 1009271236L; 
> > Also changed lastWriteTime to a long for the test.  I
> > just got the epoch of a file on my system and stuck it
> > in there for the test, converting it from milli to
> > sec.
> > 
> > An interesting note: Windows, Java and the Linux
> > server all had different ideas about what hour it was.
> >  Ahh, dates and times...
> > 
> > Windows: right-clicked properties on the file
> > Tuesday, December 25, 2001, 5:07:16 AM
> > 
> > Java: new Date(theFile.lastModified())
> > Tue Dec 25 04:07:16 EST 2001
> > 
> > RedHat 7.3: stat theFile
> > Tue Dec 25 09:07:16 2001
> > 
> > I guess I have to fiddle with TimeZones. (yuck) 
> > 
> 	Just do the reverse of ServerMessageBlock.readTime(). There
> 	may even be a writeTime somewhere. Are you a grepper?

Actually, that's a UTIME field which according to the spec is the number of
seconds  since  Jan  1,  1970.  So  you  don't  want  to  do the reverse of
readTime().  I  don't  think  you  have  to  adjust  for the time zone like
readTime()   does.   Perhaps   all   you   need   to   do   is   factor  in
SmbTransport.getSmbTransport(...).server.serverTimeZone. 

Chris,

Here's an undocumented factoid for your docs: If LastModified is 0xFFFFFFFF
the  server  uses  "now". The docs say 0. I don't know if that works but it
probably doesn't or no windows clients do that or I would have used it. 

-- 
A  program should be written to model the concepts of the task it
performs rather than the physical world or a process because this
maximizes  the  potential  for it to be applied to tasks that are
conceptually  similar and more importantly to tasks that have not
yet been conceived. 



More information about the jcifs mailing list