Age | Commit message (Collapse) | Author |
|
A lot of places were relying on AK/Traits.h to give it strnlen, memcmp,
memcpy and other related declarations.
In the quest to remove inclusion of LibC headers from Kernel files, deal
with all the fallout of this included-everywhere header including less
things.
|
|
This allows us to make all comparision operators on the class constexpr
without pulling in a bunch of boilerplate. We don't use the `<compare>`
header because it doesn't compile in the main serenity cross-build due
to the include paths to LibC being incompatible with how libc++ expects
them to be for clang builds.
|
|
No code was using these, so let's just delete them. They pollute the
lookup for every single comparison operator in the project.
|
|
We can use these to simplify Time constants throughout the codebase,
turning Time::from_milliseconds(10) into 10_ms, for example.
|
|
|
|
This solves half the problem of #12729. Note that the inverse function
time_to_tm() in LibC/time.cpp still uses a slow for-loop.
See also #13138
|
|
|
|
This patch adds the `USING_AK_GLOBALLY` macro which is enabled by
default, but can be overridden by build flags.
This is a step towards integrating Jakt and AK types.
|
|
C++20 can automatically synthesize `operator!=` from `operator==`, so
there is no point in writing such functions by hand if all they do is
call through to `operator==`.
This fixes a compile error with compilers that implement P2468 (Clang
16 currently). This paper restores the C++17 behavior that if both
`T::operator==(U)` and `T::operator!=(U)` exist, `U == T` won't be
rewritten in reverse to call `T::operator==(U)`. Removing `!=` operators
makes the rewriting possible again.
See https://reviews.llvm.org/D134529#3853062
|
|
This is the initial port of Lagom to win32. This will enable developers
to use Lagom as an alternative to vanilla STL/StandardC++Library - which
gives a much richer environment (think QtCore - but modern).
My main incentive - is to have a native Windows Ladybird working.
I am starting with AK, which does not yet fully compile (on mingw). When
AK is compiling (currently fails building StringBuffer.cpp) - I will
continue to LibCore and then the rest of the user space libraries
(excluding the GUI, which will be another different effort).
Most of the code is happily stollen from Andrew Kaster's fork - he
deserves the credit.
Co-authored-by: Andrew Kaster <akaster@serenityos.org>
|
|
|
|
This helper allows Time to be constructed from a tick count and a ticks
per second value.
|
|
In order for this method to be used within LibC itself, avoid using the
floor() method from LibM, which is not available from within LibC. This
header similarly avoids other standard headers as well.
|
|
|
|
Allow the provided year to be negative, and allow millisecond values
larger than 255.
|
|
|
|
This is to allow using these methods within an upcoming constexpr
factory method.
|
|
|
|
This is just to allow removing the 'clang-format off' directive. This
concept is only used within this header, so it doesn't need to be in the
global namespace.
|
|
|
|
... In files included by Kernel/Process.cpp and Kernel/Thread.cpp
|
|
Core::DateTime is essentially a C++ wrapper of the tm struct, so we
should support the same signed range as the underlying tm.
|
|
|
|
|
|
In the quest of removing as timespec / timeval usage in the Userland as
possible, we need a way to conveniently retrieving the current clock
time from the kernel and storing it in `AK::Time` format.
|
|
No reason for these static helper functions to not be constexpr.
|
|
clang-format >=12 format this file incorrectly/differently.
|
|
The previous implementation was too generic, and would cause conflicting
operator overload errors when included in certain code paths. Fix this
by restricting the template parameters to types which have the same
member names as `struct timespec`.
|
|
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 *
|
|
Based on #5699. Closes #5699.
|
|
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.
|
|
Since we tell the compiler to provide a default constructor we
need to initialize the member variables.
|
|
|
|
This adds a bunch of code in the hope that other, wrong code can be deleted.
Related to #5315.
|
|
|
|
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.
|
|
|
|
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).
|
|
|
|
|
|
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.
|
|
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.
|
|
|
|
|
|
tv_usec and tv_nsec should always be less than one second.
|
|
|
|
Add the ability to easily convert between timeval and timespec.
|
|
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.
|
|
|
|
|