Python Reference Guide
 
Loading...
Searching...
No Matches
BasicOperations\FBTime.py
1# Copyright 2009 Autodesk, Inc. All rights reserved.
2# Use of this software is subject to the terms of the Autodesk license agreement
3# provided at the time of installation or download, or which otherwise accompanies
4# this software in either electronic or hard copy form.
5#
6# Topic: FBTime
7#
8
9from pyfbsdk import FBSystem, FBTime, FBSleep, FBMessageBox
10
11# Get a timestamp before the sleep.
12lTs1 = FBSystem().SystemTime
13
14# Do sleep for a few milliseconds.
15lSleepTimeMS = 1234
16FBSleep( lSleepTimeMS )
17
18# Get a second timestamp after the sleep.
19lTs2 = FBSystem().SystemTime
20lTdiff = lTs2 - lTs1
21
22# Now display the actual sleep time.
23FBMessageBox( "Actual sleep time",
24 "Sleep time requested: %.3f seconds\nActual sleep time : %.3f seconds" %
25 (( lSleepTimeMS / 1000.0 ),
26 (lTdiff.GetMilliSeconds() / 1000.0)),
27 "OK",
28 None,
29 None )
30
31# There are some predefined time unit: Infinity, MinusInfinity, Zero, OneSecond, OneMinute, OneHour.
32lTs1 = FBTime.OneSecond
33lTs2 = FBTime.OneMinute
34lTdiff = lTs2 - lTs1
35
36FBMessageBox( "Time Math",
37 "one minutues - one second = %.0f seconds" %
38 (lTdiff.GetMilliSeconds() / 1000.0),
39 "OK",
40 None,
41 None )
42# Cleanup.
43del( lTs1, lTs2, lTdiff, lSleepTimeMS, FBSystem, FBTime, FBSleep, FBMessageBox )
Provides access to the underlying system, and the MotionBuilder scene.
Definition: pyfbsdk_generated.h:18771
FBSleep(kULong MilliSeconds)
Sleep function Puts system to sleep for specified time.
int FBMessageBox(str pBoxTitle, str pMessage, str pButton1Str, str pButton2Str=None, str pButton3Str=None, int pDefaultButton=0, int pScrolledMessage=0)
Dialog popup box.