Skip to content

Commit

Permalink
fixed gmtime() crash on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
colemancda committed May 20, 2016
1 parent fcdef60 commit 6a29f30
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Sources/SwiftFoundation/POSIXTime.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,11 @@ public extension tm {

var seconds = UTCSecondsSince1970

// don't free!
// The return value points to a statically allocated struct which might be overwritten by subsequent calls to any of the date and time functions.
// http://linux.die.net/man/3/gmtime
let timePointer = gmtime(&seconds)!

defer { free(timePointer) }

self = timePointer.pointee
}
}
Expand Down

0 comments on commit 6a29f30

Please sign in to comment.