summaryrefslogtreecommitdiff
path: root/AK/Time.h
AgeCommit message (Collapse)Author
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-03-13AK: Fix some overflows/underflows that weren't properly handledBen Wiederhake
Based on #5699. Closes #5699.
2021-03-08AK: Take advantage of constexpr in Time and add time conversion methodsTom
By making the Time constructor constexpr we can optimize creating a Time instance from hardcoded values. Also add more functions to convert between Time and various time units.
2021-03-08AK: Initialize the AK::Time membersTom
Since we tell the compiler to provide a default constructor we need to initialize the member variables.
2021-03-02AK: Make Time more usableBen Wiederhake
2021-03-02AK: Implement C++ 'Time' type for easier time-calculationsBen Wiederhake
This adds a bunch of code in the hope that other, wrong code can be deleted. Related to #5315.
2021-03-02AK: Remove unused templateBen Wiederhake
2020-12-28AK: Add CLOCK_*_COARSE aliases for darwin and BSD variantsAndrew Kaster
The coarse clocks in time.h are a linux extension that we've adopted. MacOS and the BSDs don't have it, so we need an alias in a platform header for Lagom builds.
2020-09-25Meta+AK: Make clang-format-10 cleanBen Wiederhake
2020-08-26AK+LibC+LibCore: Have fewer implementations of day_of_weekNico Weber
The implementation in LibC did a timestamp->day-of-week conversion which looks like a valuable thing to have. But we only need it in time_to_tm, where we already computed year/month/day -- so let's consolidate on the day_of_week function in DateTime (which is getting extracted to AK).
2020-08-26AK+LibC+LibCore: Add a days_in_year functionNico Weber
2020-08-26AK+LibC+LibCore: Have fewer implementations of days_in_monthNico Weber
2020-08-26AK+LibCore+Kernel: Have fewer implementations of day_of_yearNico Weber
The JS tests pointed out that the implementation in DateTime had an off-by-one in the month when doing the leap year check, so this change fixes that bug.
2020-08-26AK+LibC+Kernel: Have fewer implementations of year_to_days_in_epochNico Weber
I believe the implementation in RTC.cpp had an off-by-one in the year passed to is_leap_year(). If that's true, then this fixes that too.
2020-08-26AK+LibC+LibCore+Kernel: Have fewer implementations of is_leap_yearNico Weber
2020-08-03AK: Add more time convenience functions and comparison operatorsTom
2020-08-03AK: Fix adding timeval/timespecTom
tv_usec and tv_nsec should always be less than one second.
2020-06-22AK: Add timespec_add and timespec_subNico Weber
2020-04-26AK: Add timeval_to_timespec and timespec_to_timeval conversion methodsBrian Gianforcaro
Add the ability to easily convert between timeval and timespec.
2020-01-18Meta: Add license header to source filesAndreas Kling
As suggested by Joshua, this commit adds the 2-clause BSD license as a comment block to the top of every source file. For the first pass, I've just added myself for simplicity. I encourage everyone to add themselves as copyright holders of any file they've added or modified in some significant way. If I've added myself in error somewhere, feel free to replace it with the appropriate copyright holder instead. Going forward, all new source files should include a license header.
2019-06-06AK: Make timeval_add() and timeval_sub() take references.Andreas Kling
2019-05-28LibC: Move struct timeval to sys/time.h. #POSIXAndreas Kling
2019-05-18Kernel: Fix timeout support in selectRobin Burchell
The scheduler expects m_select_timeout to act as a deadline. That is, it should contain the time that a task should wake at -- but we were directly copying the time from userspace, which meant that it always returned virtually immediately. At the same time, fix CEventLoop to not rely on the broken select behavior by subtracting the current time from the time of the nearest timer.