Keil™, An ARM® Company

RealView Libraries and Floating Point Support Guide

On-Line Manuals

RealView Libraries and Floating Point Support Guide

Preface
Introduction
The C and C++ Libraries
About the C and C++ libraries
Features of the C and C++ libraries
Namespaces
Writing reentrant and thread‑safe code
Introduction to reentrancy and thread‑safety
Use of static data in the C libraries
The __user_libspace static data area
Managing locks in multithreaded applications
Using the ARM C libraries with a multithreaded app
Thread‑safety in the ARM C libraries
Thread‑safety in the ARM C++ libraries
Building an application with the C library
Using the libraries with an application
Building an application for a semihosted environme
Building an application for a non semihosting envi
Building an application without the C library
Integer and FP helper functions
Bare machine integer C
Bare machine C with floating‑point
Exploiting the C library
The standalone C library functions
Tailoring the C library to a new execution environ
How C and C++ programs use the library functions
__rt_entry
Exiting from the program
__rt_exit()
__rt_lib_init()
__rt_lib_shutdown()
Tailoring static data access
Tailoring locale and CTYPE using assembler macros
Selecting locale at link time
Selecting locale at runtime
Defining a locale block
LC_CTYPE data block
LC_COLLATE data block
LC_MONETARY data block
LC_NUMERIC data block
LC_TIME data block
_get_lconv()
localeconv()
setlocale()
_findlocale()
The lconv structure
Tailoring locale and CTYPE using C macros
Selecting locale at link time
Selecting locale at runtime
Macros and utility functions
_get_lc_ctype()
_get_lc_collate()
_get_lc_monetary()
_get_lc_numeric()
_get_lc_time()
_get_lconv()
localeconv()
setlocale()
_findlocale()
__LC_CTYPE_DEF
__LC_COLLATE_DEF
__LC_TIME_DEF
__LC_NUMERIC_DEF
__LC_MONETARY_DEF
__LC_INDEX_END
The lconv structure
Tailoring error signaling, error handling, and pro
_sys_exit()
errno
__rt_errno_addr()
__raise()
__rt_raise()
__default_signal_handler()
_ttywrch()
__rt_fp_status_addr()
Tailoring storage management
Avoiding the ARM‑supplied heap and heap‑using
Support for malloc
Tailoring the runtime memory model
The memory models
Controlling the runtime memory model
Writing your own memory model
__user_initial_stackheap()
__user_setup_stackheap()
__user_heap_extend()
__user_heap_extent()
__user_stack_cleanup_space()
__rt_heap_extend()
__rt_stack_postlongjmp()
Tailoring the input/output functions
Dependencies on low‑level functions
Target‑dependent input/output support functions
_sys_open()
_sys_close()
_sys_read()
_sys_write()
_sys_ensure()
_sys_flen()
_sys_seek()
_sys_istty()
_sys_tmpnam()
_sys_command_string()
#pragma import(_main_redirection)
Tailoring other C library functions
clock()
_clock_init()
time()
remove()
rename()
system()
getenv()
_getenv_init()
Selecting real‑time division
ISO implementation definition
ISO C library implementation definition
Standard C++ library implementation definition
C library extensions
atoll()
strtoll()
strtoull()
printf()
snprintf()
vsnprintf()
lldiv()
llabs()
wcstombs()
alloca()
strlcpy()
strlcat()
_fisatty()
__heapstats()
__heapvalid()
Library naming conventions
Placing ARM libraries
Helper libraries
Identifying library variants
The C Micro-library
Floating‑point Support

_get_lc_time()

2.8.8. _get_lc_time()

_get_lc_time() must return a pointer to a __lc_time_blk structure. Use the macros in Example 2.15 to create the structure.

Example 2.15. LC_TIME_DEF

__LC_TIME_DEF(lctime_c, "C",
              "Sun\0Mon\0Tue\0Wed\0Thu\0Fri\0Sat",
              "Sunday\0xxx" "Monday\0xxx" "Tuesday\0xx" "Wednesday\0"
              "Thursday\0x" "Friday\0xxx" "Saturday\0",
              "Jan\0Feb\0Mar\0Apr\0May\0Jun\0Jul\0Aug\0Sep\0Oct\0Nov\0Dec",
              "January\0xx" "February\0x" "March\0xxxx" "April\0xxxx"
              "May\0xxxxxx" "June\0xxxxx" "July\0xxxxx" "August\0xxx"
              "September\0" "October\0xx" "November\0x" "December\0",
              "AM", "PM",
              "%x %X", "%d %b %Y", "%H:%M:%S")
__LC_TIME_DEF(lctime_fr, "fr",
              "dim\0lun\0mar\0mer\0jeu\0ven\0sam",
              "dimanche\0" "lundi\0xxx" "mardi\0xxx" "mercredi\0"
              "jeudi\0xxx" "vendredi\0" "samedi\0x",
              "jan\0xfev\0xmars\0avr\0xmai\0xjuin\0"
              "juil\0aout\0sep\0xoct\0xnov\0xdec\0",
              "janvier\0xx" "fevrier\0xx" "mars\0xxxxx" "avril\0xxxx"
              "mai\0xxxxxx" "juin\0xxxxx" "juillet\0xx" "aout\0xxxxx"
              "septembre\0" "octobre\0xx" "novembre\0x" "decembre\0",
              "AM", "PM", "%A, %d %B %Y, %X", "%d.%m.%y", "%H:%M:%S")
__LC_INDEX_END(lctime_dummy)

void const *_get_lc_time(void const *null, char const *name) {
    return _findlocale(&lctime_c_index, name);
}

void test_lc_time(void) {
    struct tm tm;
    char timestr[256];

    tm.tm_sec = 13;
    tm.tm_min = 13;
    tm.tm_hour = 23;
    tm.tm_mday = 12;
    tm.tm_mon = 1;
    tm.tm_year = 98;
    tm.tm_wday = 4;
    tm.tm_yday = 42;
    tm.tm_isdst = 0;

    EQS(setlocale(LC_TIME, NULL), "C");      /* verify starting point */
    strftime(timestr, sizeof(timestr), "%c", &tm);
    EQS(timestr, "12 Feb 1998 23:13:13");
    EQI(!setlocale(LC_TIME, "fr"), 0);
    EQS(setlocale(LC_TIME, NULL), "fr");
    strftime(timestr, sizeof(timestr), "%c", &tm);
    EQS(timestr, "jeudi, 12 fevrier 1998, 23:13:13");
    EQI(!setlocale(LC_TIME, "C"), 0);
    EQS(setlocale(LC_TIME, NULL), "C");
    strftime(timestr, sizeof(timestr), "%c", &tm);
    EQS(timestr, "12 Feb 1998 23:13:13");
}

The offset fields are interpreted similarly to __lc_monetary_blk.

Copyright © 2007 ARM Limited. All rights reserved.ARM DUI 0378A