 import Glibc
 
 
-public struct TimeStore: CustomStringConvertible {
+public struct TimeBuffer: CustomStringConvertible {
 
-  public var store: UnsafeMutablePointer<tm>
+  public var buffer: UnsafeMutablePointer<tm>
 
   public init(secondsSinceEpoch: Int) {
     var n = secondsSinceEpoch
-    self.store = gmtime(&n)
+    self.buffer = gmtime(&n)
   }
 
   public init() {
     var n = time(nil)
-    self.store = gmtime(&n)
+    self.buffer = gmtime(&n)
   }
 
-  public init(store: UnsafeMutablePointer<tm>) {
-    self.store = store
+  public init(buffer: UnsafeMutablePointer<tm>) {
+    self.buffer = buffer
   }
 
-  public var isDst: Bool { return store.memory.tm_isdst == 1 }
+  public var isDst: Bool { return buffer.memory.tm_isdst == 1 }
 
-  public var yearday: Int32 { return store.memory.tm_yday }
+  public var yearday: Int32 { return buffer.memory.tm_yday }
 
-  public var weekday: Int32 { return store.memory.tm_wday }
+  public var weekday: Int32 { return buffer.memory.tm_wday }
 
-  public var year: Int32 { return store.memory.tm_year }
+  public var year: Int32 { return buffer.memory.tm_year }
 
-  public var month: Int32 { return store.memory.tm_mon }
+  public var month: Int32 { return buffer.memory.tm_mon }
 
-  public var day: Int32 { return store.memory.tm_mday }
+  public var day: Int32 { return buffer.memory.tm_mday }
 
-  public var hour: Int32 { return store.memory.tm_hour }
+  public var hour: Int32 { return buffer.memory.tm_hour }
 
-  public var minute: Int32 { return store.memory.tm_min }
+  public var minute: Int32 { return buffer.memory.tm_min }
 
-  public var second: Int32 { return store.memory.tm_sec }
+  public var second: Int32 { return buffer.memory.tm_sec }
 
   public var secondsSinceEpoch: Int {
     var r = Int(second)

  public init(secondsSinceEpoch: Int) {
    var n = secondsSinceEpoch
    _secondsSinceEpoch = n
    _store = TimeStore(store: gmtime(&n))
  }

  public init(store: UnsafeMutablePointer<tm>) {
    _store = TimeStore(store: store)
    _secondsSinceEpoch = _store.secondsSinceEpoch
  }

  public var day: Int {
    get { return Int(_store.day) }
    set {
      secondsSinceEpoch += (newValue - Int(_store.day)) * 86400
    }
  }

  public var hour: Int {
    get { return Int(_store.hour) }
    set {
      secondsSinceEpoch += (newValue - Int(_store.hour)) * 3600
    }
  }

  public var minute: Int {
    get { return Int(_store.minute) }
    set {
      secondsSinceEpoch += (newValue - Int(_store.minute)) * 60
    }
  }

  public var second: Int {
    get { return Int(_store.second) }
    set {
      secondsSinceEpoch += newValue - Int(_store.second)
    }
  }


  }

  public var description: String {
    return "TimeBuffer(year: \(year), month: \(month), day: \(day), " +
        "hour: \(hour), minute: \(minute), second: \(second), " +
        "weekday: \(weekday), yearday: \(yearday), isDst: \(isDst))"
  }
