Skip to content

Latest commit

 

History

History
119 lines (88 loc) · 2.79 KB

time.md

File metadata and controls

119 lines (88 loc) · 2.79 KB

sugar. time

sugar.time. init_time ()

  • Initializes the time subsystem of Sugar.
  • Is called by init_sugar().

sugar.time. update_time ()

  • Updates the time subsystem.
  • Is automatically called around love.update().

sugar.time. set_frame_waiting ([fps])

  • Sets a cap to the number of frames per second.
  • Sugarcoat will wait so that 1/fps seconds passes between each frame.
  • Call set_frame_waiting() to remove the fps cap.
  • Sugarcoat doesn't set any fps cap until you call this function.

sugar.time. t ()

  • Returns the time in seconds since the program's start-up.

sugar.time. time ()

  • Alias for t().

sugar.time. dt ()

  • Returns the time between this frame and the previous one.

sugar.time. delta_time ()

  • Alias for dt().

sugar.time. sleep (sec)

  • Stops the program for sec seconds.
  • Using this function will affect dt().

sugar.time. freeze (sec)

  • Stops the program for sec seconds.
  • Using this function will not affect dt().

sugar.time. fps ()

  • Returns the current averaged number of frames-per-second.
  • This is affected by set_frame_waiting(...).

sugar.time. fps_raw ()

  • Returns the current raw number of frames-per-second.
  • This is affected by set_frame_waiting(...).

sugar.time. frame_time ()

  • Returns the averaged time to complete one of the 16 last frames.
  • This can be used to mesure performance. The lower frame time, the better performance.

sugar.time. frame_time_raw ()

  • Returns the raw time to complete the last frame.

sugar.time. sys_ltime ()

  • Get the system time in the local time zone.
  • Returns, in this order:
    • seconds (0 - 59)
    • minutes (0 - 59)
    • hour (0 - 23)
    • day (1 - 31)
    • month (1 - 12)
    • year (full year)
    • week day (1 - 7)

sugar.time. sys_gtime ()

  • Get the system time as UTC time.
  • Returns, in this order:
    • seconds (0 - 59)
    • minutes (0 - 59)
    • hour (0 - 23)
    • day (1 - 31)
    • month (1 - 12)
    • year (full year)
    • week day (1 - 7)