# fastPOSIXct

0th

Percentile

##### Fast version of as.POSIXct.character for GMT fixed format.

fastPOSIXct converts timestamps in textual (string) form into POSIXct objects. It interprets sequences of digits separated by non-digits as a timestamp in GMT. The order of interpretation is fixed: year, month, day, hour, minute, second. Note that only true (positive) POSIX dates (since 1970-01-01 00:00:00) are supported and fastPOSIXct accepts dates up to year 2199.

It is extremely fast (compared to as.POSIXct by several orders of magnitude (on some platfroms 1000x faster) since it uses pure text parsing and no system calls.

Keywords
chron
##### Usage
fastPOSIXct(x, tz = NULL, required.components = 3L)
##### Arguments
x
string vector to interpret as timestamps
tz
timezone for the resulting POSIXct object - this is NOT the time of x, that will always be GMT!
required.components
minimum number of timestamp components that are required. For example 3 means only the date is required, 6 means all components (up to the seconds) are required. If the requirement is not met, the result for that entry will be NA.
##### Value

Numeric vector of the class POSIXct. In fact this function computes the numeric vector and calls .POSIXct to create the result.

as.POSIXct

• fastPOSIXct
##### Examples
  ## let us generate a bunch of random timestamps until today
ts <- as.character(.POSIXct(runif(1e4) * unclass(Sys.time()), "GMT"))

## convert them using as.POSIXct
system.time(a <- as.POSIXct(ts, "GMT"))

## same using the fast method
system.time(b <- fastPOSIXct(ts, "GMT"))

identical(a, b)

Documentation reproduced from package fasttime, version 1.0-2, License: GPL-2

### Community examples

Looks like there are no examples yet.