adding a time helper

This commit is contained in:
Vincent Batts 2014-08-14 16:52:27 -04:00
parent a418f5cb4b
commit 058076e94f
2 changed files with 12 additions and 0 deletions

View file

@ -2,6 +2,7 @@ package torrent
import (
"crypto/sha1"
"time"
)
// https://wiki.theory.org/BitTorrentSpecification#Metainfo_File_Structure
@ -28,6 +29,10 @@ type File struct {
Encoding string `bencode:"encoding"`
}
func (f File) CreationDateTime() time.Time {
return time.Unix(f.CreationDate, 0)
}
type InfoSection struct {
// suggested file/directory name where the file(s) are to be saved
Name string `bencode:"name,omitempty"`