• 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

Time logging in application is breaking

 
Ranch Hand
Posts: 278
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Hi
In my application, we are also time logging the start time of process and end time in Db.
Start time is record when user starts creating an account and validates it and it records end time.
Everything was working fine till we realized in few random cases in DB : start time is recorded bigger than end time which is impossible and its not secods but hours difference.
SO that ld us to invesitigation how it is working:

When process starts:
Start time is stored in the session and passed to db using java time :




When process is ongoing , record is created in DB with start time popualted and end time =null ofcourse.
Once it finishes, same record is updates, with end time =sysdate(oracle time)

1.Now i am pretty sure there could be better ways to log time (like Using System.currentTimeMillis())? Ofcouse i want to do it better.

But any of them could nt be reason of START TIME> END TIME
2.Also i have doubt if using Oracle time (sysdate ) as End time could be issue ?

3.If we debug, we are not able to replicate it ,its random & rare.

Should we try using better way to do time logging ? Please suggest.
 
Ranch Hand
Posts: 608
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So your start time is populated using the time from one server (the one where the java application is running) and your end time uses the time of another server (where Oracle is installed).

Why is it so surprising that you find cases of start time greater than end times?

are you a 100% sure that all your server are synched up and operating in the same timezone?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic