Files
haiku-beta6/src/system/libroot/posix/time/timelocal.cpp
T
Trung Nguyen d338200e2b libs/posix: Implemented new locale functions
Implemented the missing POSIX functions in <locale.h>:
newlocale, duplocale, uselocale, and freelocale, and also
provided missing type definitions for <locale.h>.

Implemented missing POSIX locale-based function variants.

Modified LocaleBackend so that it could support thread-local
locales.

Some glibc-like locale-related variables supporting
ctype and printf family of functions have also been updated
to reflect the thread-local variables present in the latest
glibc sources.

As there have been some modifications to global symbols
in libroot, libroot_stubs.c has been regenerated.

Bug: #17168
Change-Id: Ibf296c58c47d42d1d1dfb2ce64042442f2679431
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5351
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
2022-07-11 16:30:16 +00:00

41 lines
838 B
C++

/*
* Copyright 2010, Oliver Tappe, [email protected]. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#include "timelocal.h"
#include <stddef.h>
#include "LocaleBackend.h"
#include "PosixLCTimeInfo.h"
using BPrivate::Libroot::GetCurrentLocaleBackend;
using BPrivate::Libroot::LocaleBackend;
using BPrivate::Libroot::LocaleBackendData;
extern "C" const lc_time_t*
__get_current_time_locale(void)
{
if (GetCurrentLocaleBackend() != NULL)
return GetCurrentLocaleBackend()->LCTimeInfo();
return &BPrivate::Libroot::gPosixLCTimeInfo;
}
extern "C" const lc_time_t*
__get_time_locale(locale_t l)
{
LocaleBackendData* locale = (LocaleBackendData*)l;
LocaleBackend* backend = locale->backend;
if (backend != NULL)
return backend->LCTimeInfo();
return &BPrivate::Libroot::gPosixLCTimeInfo;
}