• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Date.compareTo : misbehaviour on linux environment?

 
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have this piece of code:



Is Date.compareTo() unreliable?
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
[vishwanath]: Is Date.compareTo() unreliable?

Not as far as I know. I think the most likely causes of your problem here are either: (a) one of your machines has its system clock set incorrectly, or (b) the two machines are using different TimeZones or Locales, which would affect how they interpret the endDate. I recommend adding a few lines of code to see what's going on:
 
vishwanath nadimpally
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Windows box:
This is the endDate Mon Oct 16 15:32:45 CDT 2006
This is todays date Mon Oct 16 15:34:26 CDT 2006

lnux box:
This is the endDate Mon Oct 16 15:32:45 CDT 2006
This is todays date Mon Oct 16 15:25:06 CDT 2006

The system.out.println did it.. Suddenly I realized that the times are different, thanks..
[ October 16, 2006: Message edited by: vishwanath nadimpally ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic