Original Post
🔒 Locked
Time function
Advertisement
The only real difference is that start will be be set to -1 in the first example if an error happens. But I don't think it's possible for an error to happen in the first example, so I guess there's no difference that you should ever be able to notice.
Asuming this is for time based movements, the 'difftime' as you say can be passed into your physics update methods, etc. Its just much neater to store the time difference in a temporary variable then to calculate it every time you wish to use the time difference value.
Don't quote me on that though, its only a stab in the dark at what your doing! :)
Don't quote me on that though, its only a stab in the dark at what your doing! :)
Quote:
Original post by TEUTON
1 more thing...
Why do we need to use difftime when I can simply subtract initial time from final time.
time_t is frequently defined as a long, but that is an implementation-specific choice. The Standard does not define any arithmetic properties for time_t, nor does it place any particular type constraints for it. If a particular implementation decides to represent time_t in some fashion other than as a typedef to an integral type, subtraction might not work.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement