December 11, 2024

More Testing Tips With C#

We as developers we are prone to think time is simple. However, time is a human construct, and as such is a complicated beast.

My goal of the talk is to give you an overview of the java.time API: So that you are aware that there are different concepts there and that you pick the right one for your use cases.

Let’s get started!

Assumptions: - Assuming Gregorian calendar - Leaving out Relativity - Ignoring Leapseconds - Ignoring 'wall-clock-jumps'

  • Mostly dates and time in for 'humans'

Old APIs

for a long time we had only lucky Java time APIs:

Date (original sin), sql.Date (horror down to the database) util.Calendar (OMG)

And some low level APIs: - System.currentTime - System.nanoTime

There was Joda time, which then inspired java.time, a reasonable API. The important part in this API is to understand the concepts it represents. Otherwise, the API won’t help you.

Instant

Tags: Testing C# Development