From f633d986f822108ccb100c07f6e42a66336d2449 Mon Sep 17 00:00:00 2001 From: laf Date: Wed, 19 Aug 2015 21:47:39 +0000 Subject: [PATCH] Updated influxdb-php --- lib/influxdb-php/README.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/influxdb-php/README.md b/lib/influxdb-php/README.md index 06f60943a..0972aed64 100644 --- a/lib/influxdb-php/README.md +++ b/lib/influxdb-php/README.md @@ -129,14 +129,14 @@ You can also write multiple fields to a measurement without specifying a value: null, // measurement value ['host' => 'server01', 'region' => 'us-west'], // measurement tags ['cpucount' => 10, 'free' => 1], // measurement fields - exec('date +%s%N') // timestamp in nanoseconds + exec('date +%s%N') // timestamp in nanoseconds on Linux ONLY ), new Point( 'instance', // the name of the measurement null, // measurement value ['host' => 'server01', 'region' => 'us-west'], // measurement tags ['cpucount' => 10, 'free' => 2], // measurement fields - exec('date +%s%N') // timestamp in nanoseconds + exec('date +%s%N') // timestamp in nanoseconds on Linux ONLY ) ]; @@ -166,7 +166,7 @@ Then, configure the UDP driver in the client: 0.84, ['host' => 'server01', 'region' => 'us-west'], ['cpucount' => 10], - exec('date +%s%N') // this will produce a nanosecond timestamp in Linux operating systems + exec('date +%s%N') // this will produce a nanosecond timestamp on Linux ONLY ) ]; @@ -204,6 +204,13 @@ if you specify a timestamp in seconds and the default (nanosecond) precision is $newPoints = $database->writePoints($points, Database::PRECISION_MICROSECONDS); ``` +Please note that `exec('date + %s%N')` does NOT work under MacOS; you can use PHP's `microtime` to get a timestamp with microsecond precision, like such: + +```php + list( $usec, $sec ) = explode(' ', microtime() ); + $timestamp = sprintf( '%d%06d', $sec, $usec*1000000 ); +``` + ### Creating databases When creating a database a default retention policy is added. This retention policy does not have a duration