github.com/gotranspile/cxgo@v0.3.8-0.20240118201721-29871598a6a2/libs/sys_time.go (about) 1 package libs 2 3 import ( 4 "github.com/gotranspile/cxgo/runtime/csys" 5 "github.com/gotranspile/cxgo/types" 6 ) 7 8 const ( 9 sysTimeH = "sys/time.h" 10 ) 11 12 func init() { 13 RegisterLibrary(sysTimeH, func(c *Env) *Library { 14 intT := types.IntT(4) 15 timeLib := c.LookupLibrary(timeH) 16 timevalT := timeLib.GetType("timeval") 17 timespecT := timeLib.GetType("timespec") 18 _ = timespecT 19 return &Library{ 20 Imports: map[string]string{ 21 "libc": RuntimeLibc, 22 "csys": RuntimePrefix + "csys", 23 }, 24 Idents: map[string]*types.Ident{ 25 "gettimeofday": c.NewIdent("gettimeofday", "csys.GetTimeOfDay", csys.GetTimeOfDay, c.FuncTT(intT, c.PtrT(timevalT), c.PtrT(nil))), 26 }, 27 } 28 }) 29 }