GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - StrangeLoopGames/NativeTime: Native time Unity package for burst compatibility

BranchesTags
Open more actions menu

Latest commit

 

History

31 Commits
31 Commits

Folders and files

NameName
Last commit message
Last commit date
NativeTime.Plugin
NativeTime.Plugin
 
 
Runtime
Runtime
 
 
Scripts
Scripts
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
CMakeLists.txt
CMakeLists.txt
 
 
CMakeLists.txt.meta
CMakeLists.txt.meta
 
 
LICENSE
LICENSE
 
 
LICENSE.meta
LICENSE.meta
 
 
NativeTime.Plugin.meta
NativeTime.Plugin.meta
 
 
NativeTime.sln
NativeTime.sln
 
 
NativeTime.sln.meta
NativeTime.sln.meta
 
 
README.md
README.md
 
 
README.md.meta
README.md.meta
 
 
Runtime.meta
Runtime.meta
 
 
Scripts.meta
Scripts.meta
 
 
appveyor.yml
appveyor.yml
 
 
appveyor.yml.meta
appveyor.yml.meta
 
 
package.json
package.json
 
 
package.json.meta
package.json.meta
 
 

Repository files navigation

NativeTime

Native time Unity package for burst compatibility

Why is this needed?

Due to limitations in Burst, you cannot use Stopwatch or any of its function to calculate elapsed time. You also cannot use Unity's Time.realtimeSinceStartup.

Burst does however let you call native functions so this package includes a native plugin that returns the number of nanoseconds since startup, which is converted to ticks (100ns) and passed to TimeSpan.

How to use

Create a new ValueStopwatch using ValueStopwatch.StartNew()

var sw = ValueStopwatch.StartNew();
DoThing();
var elapsed = sw.ElapsedTicks;

To reset, just reassign from ValueStopwatch.StartNew()

var sw = ValueStopwatch.StartNew();
DoThing1();
var elapsed1 = sw.ElapsedTicks;

sw = ValueStopwatch.StartNew();
DoThing2();
var elapsed2 = sw.ElapsedTicks;

You can also get the raw time in nanoseconds using ValueStopwatch.GetTimestamp()

About

Native time Unity package for burst compatibility

Resources

Readme
Activity
Custom properties

Stars

4 stars

Watchers

1 watching

Forks

2 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.