---
name: "pmparsectime"
section: "3"
platform: "linux"
package: "libpcp3-dev"
version: "3.9.10"
release: "Debian 8 (Jessie)"
platforms: ["linux"]
url: "https://new.carta.tech/__pmParseCtime"
---

# pmparsectime(3)

convert ctime(3) string to tm structure

Part of [\_\_pmParseCtime(3)](/__pmParseCtime/3.md).

## NAME

**\_\_pmParseCtime** - convert [**ctime**(3)](/ctime/3.md) string to **tm** structure

## C SYNOPSIS

**#include \<pcp/pmapi.h\>**\
 **#include \<pcp/impl.h\>**

**int \_\_pmParseCtime(const char \****string***, struct tm \****rslt***, char \*\****errmsg***);**

**cc ... -lpcp**

## DESCRIPTION

**\_\_pmParseCtime** reverses the **asctime**(3C) function.  It accepts a **string** specifying a time, and fills in the given **tm** structure.

Either a fully specified **asctime**(3C) string like "Mon Mar  4 13:07:47 1996" or a partially specified time like '1996", "Mar 1996", "Mar 4 1996", "Mar", "13:07:47", "13:07", "Mar 4 13:07:47",... is accepted.  In addition, the seconds component may be a floating point number, for example "13:07:47.5".  The 12 hour clock is also supported, so "13:07" and "1:07 pm" are equivalent.

**\_\_pmParseCtime** returns 0 if successful.  It returns -1 and a dynamically allocated error message string in **errmsg**, if the given **string** does not parse.  Be sure to **free**(3C) the error message string.

The **tm** structure returned in **rslt** should only be used as an argument to the **\_\_pmConvertTime** function, as it contains encoded information that will only be correctly interpreted by **\_\_pmConvertTime**.

## SEE ALSO

[**PMAPI**(3)](/PMAPI/3.md), [**pmParseInterval**(3)](/pmParseInterval/3.md), [**\_\_pmConvertTime**(3)](/__pmConvertTime/3.md) and [**\_\_pmParseTime**(3)](/__pmParseTime/3.md).
