Roman Numeral Conversion API
SourceForge.net Logo
README
ChangeLog
Screen Shots
SourceForge Resources
Download
Report Bugs
Browse CVS
Man Pages
roman(7)
int2roman(3)
roman2int(3)
roman_asctime(3)
roman_ctime(3)
roman_strftime(3)
romandate(1)
romannum(1)
Examples
int2roman.c
roman2int.c
roman_asctime.c
roman_ctime.c
roman_strftime.c
 
ROMAN NUMERAL API

ROMAN NUMERAL API


NAME

roman_strftime − convert

LIBRARY

Roman Numeral Conversion API (libroman, -lroman)

SYNOPSIS

#include <time.h>
#incude <roman.h>

size_t roman_strftime(char * str, size_t len, const char * fmt, const struct tm * tm);

DESCRIPTION

The function roman_strftime formats the information from tm into the buffer str, according to the format string pointed to by fmt.

No more than len characters, including the terminating NULL character, will be placed into the buffer. roman_strftime returns the numer of characters copied into the buffer, not counting the terminating NULL character.

The fmt string consists of zero or more format operands and ordinary characters. All ordinary characters are copied directly into the buffer. A format operand consists of a ‘%’ character and one of the following characters:

%%

is a literal %

%a

is replaced by the abbreviated Latin weekday name (Sol, Lun, Mar, Mer, Lov, Ven, Sat).

%A

is replaced by the full Latin weekday name (Solis, Linae, Martis, Mercurii, Lovis, Veneris, Saturni).

%b

is replaced by the abbreviated Latin month name (Jan, Feb, Mar, Apr, Mai, Jun, Jul, Aug, Sep, Oct, Nov, Dec).

%B

is replaced by the full Latin month name (Januarius, Februarius, Martius, Aprilis, Maius, Junius, Julius, Augustus, September, October, Novembris, December).

%c

is the same as %a %b %e %H:%M:%S %Z %Y.

%C

is replaced by (year / 100).

%d

is replaced by the day of month (I..XXXI).

%D

is the same as %m/%d/%Y.

%e

is the same as %d.

%F

is the same as %Y-%m-%d.

%g

is replaced by the year of the century (N..XCIX).

%G

is replaced by the year.

%h

is the same as %b.

%H

is replaced by the hour using 24-hour notation (N..XXIII).

%I

is replaced by the hour using 12-hour notation (I..XII).

%j

is replaced by the day of year (I..XXXLXVI).

%k

is the same as %H.

%l

is the same as %I.

%m

is replaced by the month (I..XII).

%M

is replaced by the minute (N..LIX).

%n

is replaced by a <newline>.

%p

is replaced by upper case AM or PM indicator.

%P

is replaced by lower case AM or PM indicator.

%r

is the same as %I:%M:%S %p.

%R

is the same as %H:%M.

%S

is replaced by the second (N..LX).

%t

is replaced by a horizontal <tab>.

%T

is the same as %H:%M:%S.

%u

is replaced by the day of week (I..VII); I represents Lunae.

%w

is replaced by the day of week (N..VI); N represents Solis.

%x

is the same as %m/%d/%Y.

%X

is the same as %T.

%y

is the same as %g.

%Y

is the same as %G.

%z

is replaced by the GMT offset in minutes.

%Z

is replaced by the time zone or nothing if no time zone is determinable.

RETURN VALUES

If successful, roman_strftime returns the number of characters copied into the buffer, not counting the terminating NULL character. If an error is encountered, roman_strftime returns zero and errno will be set. If an error is encountered the buffer contents are indeterminate.

ERRORS

EFAULT

bad address in either str, fmt, or tm.

EINVAL

invalid format operand in fmt.

ENOBUFS

Insufficient storage space available in str.

EXAMPLES

#include <time.h>
#include <stdio.h>
#include <roman.h>

int main(void);

int main(void)
{
time_t t
;
char buff[512];
size_t len
;
struct tm * tm
;

t = time(NULL);

tm = localtime(&t);

len = roman_strftime(buff, 512, "%a %b %e %H:%M:%S %Z %Y", tm);
if
(len)
printf
("%s\n", buff);
else
perror
("roman_strftime()");

return(0);
}

REPORTING BUGS

Report bugs to <syzdek@users.sourceforge.net>.

COPYRIGHT

Copyright (C) 2007 David M. Syzdek.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

SEE ALSO

roman(7), romandate(1), romannum(1), int2roman(3), roman2int(3), roman_ctime(3)