Embarcadero’s annual coding event, CodeRage, starts tomorrow. It’s a series of events about Delphi and C++ Builder. There are talks by Embarcadero employees, software vendors with products for RAD Studio, Delphi and Builder and users. CodeRage 2018 lasts for three days and you can see the schedule here. Best of all, it’s free and open to the public. To register, go to CodeRage 2018.
Some C++ topics this year are:
- An interview with Bjarne Stroustrup!
- Game development for beginners
- C++ 17 in Builder 10.3
- Working with databases in C++
In the previous part of this tutorial we downloaded and set up Howard Hinnant‘s date library. This is a library written in standard C++ that lets us work with dates much more easily than what we can currently do. We learned how to work around some potential compiler errors and how to create compile-time and run-time dates. In this part of the tutorial we’ll discuss the library’s error handling and efficiency, and then concentrate on doing calculations with the dates.
Continue reading “Tutorial Part 2- A Portable Date Library for C++”
How do we work with dates and times in C++? One way is to use the C date and time library. This library has functions for manipulating times, such as
difftime; functions for converting formats of times and dates, e.g.,
mktime; and various types, such as
tm for calendar time,
time_t for the time since the epoch, and
clock_t, which denotes a process running time. In addition, since C++11 we’ve had a nice library for dealing with points in and durations of time, namely,
These libraries do have their problems though. The C library (not surprisingly) looks like just that – a C library, and not like C++ code. For example, it has no classes, there are no operators for performing such useful functions as determining the amount of time between two dates or whether one date comes before or after another date, and the internals of the library are exposed and often clumsy to work with. The
chrono library overcomes these deficiencies because it was designed from the ground up to be in C++. Unfortunately,
chrono has no facilities for working with calendar dates.
Continue reading “Tutorial Part 1- A Portable Date Library for C++”