[Info-vax] Simple Pascal question

Arne Vajhøj arne at vajhoej.dk
Thu Sep 5 13:30:48 EDT 2024


On 8/7/2024 5:35 PM, Lawrence D'Oliveiro wrote:
> Dates/times? You have to contend with an API that has accumulated so much
> legacy cruft, that you are left with an old class where every single
> member is deprecated, yet the class itself is still needed in the newer-
> style calls.

That is also one of Roland's pet peeves.

But it should not be that hard.

There are 3 generations of time API in Java:
* java.util.Date (Java 1.0)
* java.util.Date + java.util.*Calendar + java.text.*DateFormat
   (Java 1.1 - 1.7)
* java.util.time.* (Java 1.8-)

But if we look at the second, then the trick is to realize
the mapping of functionality.

java.util.Date ~ C time_t type and time function
java.util.Calendar/GregorianCalendar ~ C mktime/gmtime/localtime
java.text.DateFormat/SimpleDateFormat ~ C strftime/strptime

Even though all the conversion functionality was moved from
Date to Calendar, then Date is still the basic point in time
type - the time_t of Java. So it did not go away.

Arne




More information about the Info-vax mailing list