time.go 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. package packages
  2. import (
  3. "reflect"
  4. "time"
  5. "github.com/mattn/anko/env"
  6. )
  7. func init() {
  8. env.Packages["time"] = map[string]reflect.Value{
  9. "ANSIC": reflect.ValueOf(time.ANSIC),
  10. "After": reflect.ValueOf(time.After),
  11. "AfterFunc": reflect.ValueOf(time.AfterFunc),
  12. "April": reflect.ValueOf(time.April),
  13. "August": reflect.ValueOf(time.August),
  14. "Date": reflect.ValueOf(time.Date),
  15. "December": reflect.ValueOf(time.December),
  16. "February": reflect.ValueOf(time.February),
  17. "FixedZone": reflect.ValueOf(time.FixedZone),
  18. "Friday": reflect.ValueOf(time.Friday),
  19. "Hour": reflect.ValueOf(time.Hour),
  20. "January": reflect.ValueOf(time.January),
  21. "July": reflect.ValueOf(time.July),
  22. "June": reflect.ValueOf(time.June),
  23. "Kitchen": reflect.ValueOf(time.Kitchen),
  24. "LoadLocation": reflect.ValueOf(time.LoadLocation),
  25. "March": reflect.ValueOf(time.March),
  26. "May": reflect.ValueOf(time.May),
  27. "Microsecond": reflect.ValueOf(time.Microsecond),
  28. "Millisecond": reflect.ValueOf(time.Millisecond),
  29. "Minute": reflect.ValueOf(time.Minute),
  30. "Monday": reflect.ValueOf(time.Monday),
  31. "Nanosecond": reflect.ValueOf(time.Nanosecond),
  32. "NewTicker": reflect.ValueOf(time.NewTicker),
  33. "NewTimer": reflect.ValueOf(time.NewTimer),
  34. "November": reflect.ValueOf(time.November),
  35. "Now": reflect.ValueOf(time.Now),
  36. "October": reflect.ValueOf(time.October),
  37. "Parse": reflect.ValueOf(time.Parse),
  38. "ParseDuration": reflect.ValueOf(time.ParseDuration),
  39. "ParseInLocation": reflect.ValueOf(time.ParseInLocation),
  40. "RFC1123": reflect.ValueOf(time.RFC1123),
  41. "RFC1123Z": reflect.ValueOf(time.RFC1123Z),
  42. "RFC3339": reflect.ValueOf(time.RFC3339),
  43. "RFC3339Nano": reflect.ValueOf(time.RFC3339Nano),
  44. "RFC822": reflect.ValueOf(time.RFC822),
  45. "RFC822Z": reflect.ValueOf(time.RFC822Z),
  46. "RFC850": reflect.ValueOf(time.RFC850),
  47. "RubyDate": reflect.ValueOf(time.RubyDate),
  48. "Saturday": reflect.ValueOf(time.Saturday),
  49. "Second": reflect.ValueOf(time.Second),
  50. "September": reflect.ValueOf(time.September),
  51. "Since": reflect.ValueOf(time.Since),
  52. "Sleep": reflect.ValueOf(time.Sleep),
  53. "Stamp": reflect.ValueOf(time.Stamp),
  54. "StampMicro": reflect.ValueOf(time.StampMicro),
  55. "StampMilli": reflect.ValueOf(time.StampMilli),
  56. "StampNano": reflect.ValueOf(time.StampNano),
  57. "Sunday": reflect.ValueOf(time.Sunday),
  58. "Thursday": reflect.ValueOf(time.Thursday),
  59. "Tick": reflect.ValueOf(time.Tick),
  60. "Tuesday": reflect.ValueOf(time.Tuesday),
  61. "Unix": reflect.ValueOf(time.Unix),
  62. "UnixDate": reflect.ValueOf(time.UnixDate),
  63. "Wednesday": reflect.ValueOf(time.Wednesday),
  64. }
  65. env.PackageTypes["time"] = map[string]reflect.Type{
  66. "Duration": reflect.TypeOf(time.Duration(0)),
  67. "Ticker": reflect.TypeOf(time.Ticker{}),
  68. "Time": reflect.TypeOf(time.Time{}),
  69. }
  70. timeGo18()
  71. timeGo110()
  72. }