videoshot.go 539 B

123456789101112131415161718192021222324252627282930313233
  1. package videoshot
  2. import (
  3. "time"
  4. xtime "go-common/library/time"
  5. )
  6. var (
  7. _verDate = time.Date(2015, 6, 1, 0, 0, 0, 0, time.Local)
  8. )
  9. // Videoshot is struct.
  10. type Videoshot struct {
  11. Cid int64
  12. Count int
  13. version int
  14. CTime xtime.Time
  15. MTime xtime.Time
  16. }
  17. // Version get version.
  18. func (v *Videoshot) Version() int {
  19. if v.version > 0 {
  20. return v.version
  21. }
  22. return int(v.MTime.Time().Sub(_verDate) / time.Second)
  23. }
  24. // SetVersion set version from cache.
  25. func (v *Videoshot) SetVersion(version int) {
  26. v.version = version
  27. }