Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

Time interval

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-05-2009, 07:36 AM
Knows the basics
 
Join Date: May 2007
Location: Czech Republic
Posts: 72
Awards Showcase
Beta Tester 
Total Awards: 1
Default Time interval

Hi,
I have a problem with counting the time interval. I'm trying to count, how much time is between two events in my software, but I'm not succesful.
For example in this code
Code:
        TimeFormat("hh:mm:ss")
Time1 = 
"09:00:00"
Time2 = 
"09:00:06"
Ticks1 = TimeParse(Time1)
Ticks2 = TimeParse(Time2)
T = Ticks2 - Ticks1
DeltaT = Time(T)
the result is 12:00:06 and not 00:00:06 as I would expect.
What am I doing wrong ?
Thanks Petr.
Reply With Quote
  #2 (permalink)  
Old 11-05-2009, 07:53 AM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 4,463
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default

You must use 24 hours format:
Code:
<font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">TimeFormat</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">(</font></font></font></font><font face="Courier New"><font size="2"><font color="#800000"><font face="Courier New"><font size="2"><font color="#800000"><font face="Courier New"><font size="2"><font color="#800000">"HH:mm:ss"</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">)</font></font></font></font>
instead of 12 hours format
Code:
<font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">TimeFormat</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">(</font></font></font></font><font face="Courier New"><font size="2"><font color="#800000"><font face="Courier New"><font size="2"><font color="#800000"><font face="Courier New"><font size="2"><font color="#800000">"hh:mm:ss"</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">)</font></font></font></font>
In 12 hours format time begins with 12:00:00PM
In 24 hours format time begins with 00:00:00

Best regards.
__________________
Klaus
Switzerland

Beginner's Guide / User's Guide
Reply With Quote
  #3 (permalink)  
Old 11-05-2009, 08:00 AM
Knows the basics
 
Join Date: May 2007
Location: Czech Republic
Posts: 72
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Thank You very much, Klaus.
Petr
Reply With Quote
  #4 (permalink)  
Old 11-05-2009, 08:01 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Quote:
Originally Posted by petrbury View Post
TimeFormat("hh:mm:ss")
You are specifying 12 hour time format. See Help -> Main Help -> Keywords -> Time -> TimeFormat.
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
Reply With Quote
  #5 (permalink)  
Old 11-05-2009, 10:18 AM
Basic4ppc Expert
 
Join Date: Jul 2008
Location: Borchen, Germany
Posts: 571
Send a message via Skype™ to corwin42
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Be aware that measuring time with b4ppc is very inaccurate on the device. If you want to measure intervals smaller than 1 second you should use GetTickCount from dzhw.library.

Greetings,
Markus
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Wake up PC on time? Byak@ Questions (Windows Mobile) 6 11-10-2009 01:18 PM
Adding time Sascha K. Questions (Windows Mobile) 3 03-23-2008 07:46 PM
Time question Cableguy Questions (Windows Mobile) 2 01-05-2008 10:49 AM
Add & Subtract Time cdeane Questions (Windows Mobile) 11 11-28-2007 08:24 AM
Time Zone alfcen Basic4ppc Wishlist 8 10-05-2007 05:47 AM


All times are GMT. The time now is 10:35 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0