Skip to content

Commit b1a123d

Browse files
committed
don't use deprecated Time class
1 parent ff9c1fb commit b1a123d

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

core/src/processing/core/PApplet.java

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
import android.opengl.GLSurfaceView;
4444
import android.os.Bundle;
4545
import android.os.Handler;
46-
import android.text.format.Time;
46+
//import android.text.format.Time;
4747
import android.util.*;
4848
import android.view.LayoutInflater;
4949
import android.view.MotionEvent;
@@ -3080,7 +3080,7 @@ public void focusLost() { }
30803080
// getting the time
30813081

30823082

3083-
static protected Time time = new Time();
3083+
// static protected Time time = new Time();
30843084

30853085
/**
30863086
* Get the number of milliseconds since the applet started.
@@ -3094,16 +3094,16 @@ public int millis() {
30943094

30953095
/** Seconds position of the current time. */
30963096
static public int second() {
3097-
//return Calendar.getInstance().get(Calendar.SECOND);
3098-
time.setToNow();
3099-
return time.second;
3097+
return Calendar.getInstance().get(Calendar.SECOND);
3098+
// time.setToNow();
3099+
// return time.second;
31003100
}
31013101

31023102
/** Minutes position of the current time. */
31033103
static public int minute() {
3104-
//return Calendar.getInstance().get(Calendar.MINUTE);
3105-
time.setToNow();
3106-
return time.minute;
3104+
return Calendar.getInstance().get(Calendar.MINUTE);
3105+
// time.setToNow();
3106+
// return time.minute;
31073107
}
31083108

31093109
/**
@@ -3114,9 +3114,9 @@ static public int minute() {
31143114
* if (yankeeHour == 0) yankeeHour = 12;</PRE>
31153115
*/
31163116
static public int hour() {
3117-
//return Calendar.getInstance().get(Calendar.HOUR_OF_DAY);
3118-
time.setToNow();
3119-
return time.hour;
3117+
return Calendar.getInstance().get(Calendar.HOUR_OF_DAY);
3118+
// time.setToNow();
3119+
// return time.hour;
31203120
}
31213121

31223122
/**
@@ -3126,28 +3126,28 @@ static public int hour() {
31263126
* or day of the year (1..365) then use java's Calendar.get()
31273127
*/
31283128
static public int day() {
3129-
//return Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
3130-
time.setToNow();
3131-
return time.monthDay;
3129+
return Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
3130+
// time.setToNow();
3131+
// return time.monthDay;
31323132
}
31333133

31343134
/**
31353135
* Get the current month in range 1 through 12.
31363136
*/
31373137
static public int month() {
31383138
// months are number 0..11 so change to colloquial 1..12
3139-
//return Calendar.getInstance().get(Calendar.MONTH) + 1;
3140-
time.setToNow();
3141-
return time.month + 1;
3139+
return Calendar.getInstance().get(Calendar.MONTH) + 1;
3140+
// time.setToNow();
3141+
// return time.month + 1;
31423142
}
31433143

31443144
/**
31453145
* Get the current year.
31463146
*/
31473147
static public int year() {
3148-
//return Calendar.getInstance().get(Calendar.YEAR);
3149-
time.setToNow();
3150-
return time.year;
3148+
return Calendar.getInstance().get(Calendar.YEAR);
3149+
// time.setToNow();
3150+
// return time.year;
31513151
}
31523152

31533153

0 commit comments

Comments
 (0)