Date And Time Routines - HP 9000 User Manual

Computers
Hide thumbs Also See for 9000:
Table of Contents

Advertisement

6
Date and Time
The
ctime(3C)
date and time routines:
ctime
and
asctime
always give
C
locale
results. To get locale-sensitive results, use
strftime.
Table 6-14. Date and Time Routines
Routine
Description
strftime
Like ctime, but accepts an optional format string
(which should be placed in a message catalog).
nl_langinfo(D_T_FMT)
Returns a local time/date format string.
Monetary Formatting
Generalized monetary formatting is more involved than numeric formatting
since in some countries the currency symbol is placed before the amount, while
in other countries it is placed within or after the amount. There are no library
routines that provide monetary formatting; you will have to provide your own.
The currency symbol and position information is available in the structure
returned by
localconv
(this information is also available through the slower
nl_langinfo
call described shortly). The following example illustrates how
you may use this information to flexibly format monetary values for an
internationalized application.
The following example program prints a monetary value for the currently active
locale. The NLS library routine
localeconv
returns a structure containing
locale-specific numeric formatting conventions. Two members of this structure
are accessed:
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
main (argc, argv)
int argc;
Set to
1
if the currency symbol precedes a non-negative
monetary quantity; otherwise set to
o.
Set to
1
if the currency symbol precedes a negative
monetary quantity; otherwise set to
o.
6-26
Developing International Software

Advertisement

Table of Contents
loading

Table of Contents