Platforms to show: All Mac Windows Linux Cross-Platform

Back to MidiPacketMBS class.

MidiPacketMBS.AbsoluteToNanoseconds(value as UInt64) as UInt64

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method MIDI MBS MacCF Plugin 10.3 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Converts an absolute time value to a nanoseconds time value.
Example
dim x as UInt64 = MidiPacketMBS.CurrentTime

dim y as UInt64 = x + MidiPacketMBS.NanosecondsToAbsolute(5)

MsgBox str(x)+" + 5 ns = "+str(Y)

MidiPacketMBS.CurrentTime as UInt64

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method MIDI MBS MacCF Plugin 10.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the current time of the computer as an absolute time value.
Example
dim u as uint64 = MidiPacketMBS.CurrentTime
dim n as uint64 = MidiPacketMBS.AbsoluteToNanoseconds(u)
dim x as Double = n / 1000000000.0

MsgBox str(u)+" "+str(n)+" "+str(x)

dim d as new date
d.Minute = 0
d.Hour = 0
d.Second = 0
d.TotalSeconds = d.TotalSeconds + x

MsgBox d.ShortTime // how long the mac is running.

While some Macs do have host clock time being in nanoseconds, this is not guaranteed. So use the function AbsoluteToNanoseconds to convert to nanoseconds.

MidiPacketMBS.NanosecondsToAbsolute(value as UInt64) as UInt64

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method MIDI MBS MacCF Plugin 10.3 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Converts a nanoseconds value to an absolute time.
Example
dim x as UInt64 = MidiPacketMBS.CurrentTime

dim y as UInt64 = MidiPacketMBS.NanosecondsToAbsolute(x)

dim seconds as uint64 = y / 1000000000
dim hours as uint64 = seconds / 3600
seconds = seconds - hours*3600
dim minutes as uint64 = seconds / 60
seconds = seconds - minutes*60

// shows how long the Mac is running:
MsgBox str(hours)+" hours, "+str(minutes)+" minutes, "+str(seconds)+" seconds"

The items on this page are in the following plugins: MBS MacCF Plugin.


The biggest plugin in space...