summaryrefslogtreecommitdiffstats
path: root/src/utils.cc
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2012-04-20 18:48:18 -0700
committerElliott Hughes <enh@google.com>2012-04-20 18:57:19 -0700
commit7b9d996e4cd7d154bb1a244d67139aff0c363cf2 (patch)
treea9dabe8f910b4b8bf29c2f4285d860995e25f58d /src/utils.cc
parent934100aea5a0f498c17e2c4a1fd0193af1557b42 (diff)
downloadart-7b9d996e4cd7d154bb1a244d67139aff0c363cf2.zip
art-7b9d996e4cd7d154bb1a244d67139aff0c363cf2.tar.gz
art-7b9d996e4cd7d154bb1a244d67139aff0c363cf2.tar.bz2
Tidy up some C-isms.
Change-Id: I53b457cab9067369320457549071fc3e4c23c81b
Diffstat (limited to 'src/utils.cc')
-rw-r--r--src/utils.cc20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/utils.cc b/src/utils.cc
index ea50073..dc1ebff 100644
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -87,8 +87,8 @@ bool ReadFileToString(const std::string& file_name, std::string* result) {
std::string GetIsoDate() {
time_t now = time(NULL);
- struct tm tmbuf;
- struct tm* ptm = localtime_r(&now, &tmbuf);
+ tm tmbuf;
+ tm* ptm = localtime_r(&now, &tmbuf);
return StringPrintf("%04d-%02d-%02d %02d:%02d:%02d",
ptm->tm_year + 1900, ptm->tm_mon+1, ptm->tm_mday,
ptm->tm_hour, ptm->tm_min, ptm->tm_sec);
@@ -96,11 +96,11 @@ std::string GetIsoDate() {
uint64_t MilliTime() {
#if defined(HAVE_POSIX_CLOCKS)
- struct timespec now;
+ timespec now;
clock_gettime(CLOCK_MONOTONIC, &now);
return static_cast<uint64_t>(now.tv_sec) * 1000LL + now.tv_nsec / 1000000LL;
#else
- struct timeval now;
+ timeval now;
gettimeofday(&now, NULL);
return static_cast<uint64_t>(now.tv_sec) * 1000LL + now.tv_usec / 1000LL;
#endif
@@ -108,11 +108,11 @@ uint64_t MilliTime() {
uint64_t MicroTime() {
#if defined(HAVE_POSIX_CLOCKS)
- struct timespec now;
+ timespec now;
clock_gettime(CLOCK_MONOTONIC, &now);
return static_cast<uint64_t>(now.tv_sec) * 1000000LL + now.tv_nsec / 1000LL;
#else
- struct timeval now;
+ timeval now;
gettimeofday(&now, NULL);
return static_cast<uint64_t>(now.tv_sec) * 1000000LL + now.tv_usec;
#endif
@@ -120,11 +120,11 @@ uint64_t MicroTime() {
uint64_t NanoTime() {
#if defined(HAVE_POSIX_CLOCKS)
- struct timespec now;
+ timespec now;
clock_gettime(CLOCK_MONOTONIC, &now);
return static_cast<uint64_t>(now.tv_sec) * 1000000000LL + now.tv_nsec;
#else
- struct timeval now;
+ timeval now;
gettimeofday(&now, NULL);
return static_cast<uint64_t>(now.tv_sec) * 1000000000LL + now.tv_usec * 1000LL;
#endif
@@ -132,7 +132,7 @@ uint64_t NanoTime() {
uint64_t ThreadCpuMicroTime() {
#if defined(HAVE_POSIX_CLOCKS)
- struct timespec now;
+ timespec now;
clock_gettime(CLOCK_THREAD_CPUTIME_ID, &now);
return static_cast<uint64_t>(now.tv_sec) * 1000000LL + now.tv_nsec / 1000LL;
#else
@@ -143,7 +143,7 @@ uint64_t ThreadCpuMicroTime() {
uint64_t ThreadCpuNanoTime() {
#if defined(HAVE_POSIX_CLOCKS)
- struct timespec now;
+ timespec now;
clock_gettime(CLOCK_THREAD_CPUTIME_ID, &now);
return static_cast<uint64_t>(now.tv_sec) * 1000000000LL + now.tv_nsec;
#else