#include <ctype.h>
#include <inttypes.h>
#include <math.h>
#include <stdint.h>
#include <stdlib.h>
#include <sys/time.h>
#include <unistd.h>
#include "common/gru_alloc.h"
#include "common/gru_portable.h"
Go to the source code of this file.
An alias to struct timeval.
Add minutes to a timestamp object.
- Parameters
-
t | timestamp |
count | number of minutes to add |
Add seconds to a timestamp object.
- Parameters
-
t | timestamp |
count | number of seconds to add |
Add seconds to a timestamp object.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Converts milliseconds since epoch to a timestamp.
- Parameters
-
timestamp | milliseconds since Epoch |
- Returns
- a timestamp object with the converted data
Converts an unformatted string of milliseconds since epoch to a timestamp.
- Parameters
-
ts | A numeric string representing the milliseconds since epoch (ie.: 1484719545264) |
- Returns
- a timestamp object with the parsed data
Gets the current moment in time.
- Returns
- a timestamp object with the current point in time
Gets the current moment in time in milliseconds.
- Returns
- current time in milliseconds since Epoch
Read a string in the format seconds.microseconds and return a struct timeval.
The microseconds represents the fraction of the seconds value and should not be equal or greater than 1000000. Otherwise, the code will only consider the first 6 bytes of the microseconds string.
- Parameters
-
str | The string in the format seconds.microseconds |
- Returns
- a timestamp object with the parsed data
Converst a timestamp to milliseconds.
- Parameters
-
ts | A pointer to a timestamp structure |
- Returns
- the timestamp as a milliseconds since epoch
Write a timeval structure to a string.
- Parameters
-
- Returns
- A string that must be free'd after use