Permalink
Browse files

Mise à jour de la méthode calculant la zone GMT,plus simple et plus sûr

!
  • Loading branch information...
1 parent 9fef0ec commit e647097f4a53a8c429b494bcd4dcf0b6a9ad2ef2 diego.antognin committed Apr 28, 2012
Showing with 5 additions and 6 deletions.
  1. +5 −6 projetp1/src/com/github/projetp1/Mathematics.java
@@ -78,7 +78,8 @@ public Mathematics(Calendar _date, double _dLat, double _dLon,double _dDec,doubl
this.dMinute = _date.get(Calendar.MINUTE);
this.dSecond = _date.get(Calendar.SECOND);
- this.dGMT = this.dHour - calculate_Hour_GMT(_date);
+ this.dGMT = calculate_Hour_GMT(_date);
+ System.out.println(this.dGMT);
this.dDay = Mathematics.kadditionnal_dDay_of_Date_object + _date.get(Calendar.DATE);
this.dMonth = Mathematics.kadditionnal_dMonth_of_Date_object + _date.get(Calendar.MONTH);
this.dYear = Mathematics.kadditionnal_dYear_of_gregorian_calendar + _date.get(Calendar.YEAR);
@@ -162,11 +163,9 @@ public void get_all()
*/
static private int calculate_Hour_GMT(Calendar _cal)
{
- SimpleDateFormat formatter = new SimpleDateFormat("HH");
- formatter.setTimeZone(TimeZone.getTimeZone("UTC"));
-
- String timestamp = formatter.format(_cal.getTime());
- return Integer.valueOf(timestamp);
+ TimeZone l_t = _cal.getTimeZone();
+
+ return l_t.getOffset(_cal.getTimeInMillis())/1000/3600;
}
/**

0 comments on commit e647097

Please sign in to comment.