9

I see asctime in C, C++ and Python. What does the abbreviation mean? All those functions of max 8 characters are pretty obvious (strcpy e.g.) but this one eludes me.

Is it ASCII time? Is it 'as ctime' or it is 'as character time'?

Google: no help.

2

1 Answer 1

21

The ANSI C design rationale document implies that the name stands for ‘ASCII time’:

4.12.3.1 The asctime function

Although the name of this function suggests a conflict with the principle of removing ASCII dependencies from the Standard, the name has been retained due to prior art.

The function was added in Unix V7 where it is described as

Asctime converts a broken-down time to ASCII and returns a pointer to a 26-character string.

1
  • asctime is a badly designed function anyhow. I'd recommend using strftime instead. Similar to how strtol is better to work with than atoi Commented Nov 15, 2022 at 16:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .