blob: f029f8dadca024d5a5dea520cd8c6cbb2f0f8f3f [file] [log] [blame]
Reid Spencer0d5716e2004-09-25 05:03:54 +00001//===- Unix/TimeValue.cpp - Unix TimeValue Implementation -------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file was developed by Reid Spencer and is distributed under the
6// University of Illinois Open Source License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file implements the Unix specific portion of the TimeValue class.
11//
12//===----------------------------------------------------------------------===//
13
14//===----------------------------------------------------------------------===//
15//=== WARNING: Implementation here must contain only generic UNIX code that
16//=== is guaranteed to work on *all* UNIX variants.
17//===----------------------------------------------------------------------===//
18
19#include "Unix.h"
20
Reid Spencerd3518712004-11-14 22:10:08 +000021#include <time.h>
22
23namespace llvm {
24 using namespace sys;
25
26
27std::string TimeValue::toString() {
28 char buffer[32];
29
30 time_t ourTime = time_t(this->toEpochTime());
31 ::asctime_r(::localtime(&ourTime), buffer);
32
33 std::string result(buffer);
34 return result.substr(0,24);
35}
36
Reid Spencer0d5716e2004-09-25 05:03:54 +000037}
38// vim: sw=2 smartindent smarttab tw=80 autoindent expandtab