forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


DATETIME + OPTION FIELDSEP problem

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
marty
Professional Member
Professional Member


Joined: 10 May 2001
Posts: 789

PostPosted: Tue Dec 03, 2002 4:42 pm    Post subject: DATETIME + OPTION FIELDSEP problem Reply with quote

Hi Im having a problem with a function thats translates a timer from VDSMEDIA.DLL to regular Minutes:Seconds.

Ive put the OPTION FIELDSEP,"." and when it gets to this part:


Code:
rem Current position and Total lenght
  %%SecsInDay = @PROD(@PROD(24,60),60)
  %%Duration = @DATETIME(nn:ss,@FDIV(@FORMAT(@media(duration,mMedia),.0),%%SecsInDay))
  %%Position = @DATETIME(nn:ss,@FDIV(@FORMAT(@media(position,mMedia),.0),%%SecsInDay))
  dialog set,timepos1,%%Position/%%Duration


I get the following error "Exception: Invalid date\time at line..." (the line where the %%duration variable is) on a Windows system that has a "," as the

default separator in the regional settings.

It doesnt give the error on most on my Windows system, where the parameter is a "." in the regional settings.

Thanks in advance for your help Wink
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
cnodnarb
Professional Member
Professional Member


Joined: 11 Sep 2002
Posts: 766
Location: Eastman, GA

PostPosted: Tue Dec 03, 2002 5:02 pm    Post subject: Reply with quote

Try this...Sometimes the way you have setup will still return 9.5 or (number).5

Code:

rem Current position and Total lenght
  %%SecsInDay = @PROD(@PROD(24,60),60)
  %%Duration = @DATETIME(nn:ss,@FORMAT(@FDIV(@media(duration,mMedia),%%SecsInDay),.0))
  %%Position = @DATETIME(nn:ss,@FORMAT(@FDIV(@media(position,mMedia),%%SecsInDay),.0))
  dialog set,timepos1,%%Position/%%Duration


Let me know if this works Wink

NodNarb
Back to top
View user's profile Send private message AIM Address
marty
Professional Member
Professional Member


Joined: 10 May 2001
Posts: 789

PostPosted: Tue Dec 03, 2002 5:22 pm    Post subject: Reply with quote

Sorry it doesnt work, it stays always with zeros (00:00/00:00)

Wink
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Tue Dec 03, 2002 10:41 pm    Post subject: Reply with quote

I'm not real sure about this one but have you tried putting .0 in quotes?
_________________
-Sheep
My pockets hurt...
Back to top
View user's profile Send private message Send e-mail
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Tue Dec 03, 2002 11:16 pm    Post subject: Reply with quote

Have ya checked that @media(duration,mMedia)
and @media(position,mMedia) both return exactly
the same format on the problem systems?

If so - what format are they in?

BTW, you can change the DECIMALSEP back and forth
if you can determine when each one is needed... Wink

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Tue Dec 03, 2002 11:34 pm    Post subject: Reply with quote

I was thinking along those lines also, but didn't think the returned number would be the problem. Now that I think about it though, if the DLL is returning a number with a "," then it won't calculate right.
_________________
-Sheep
My pockets hurt...
Back to top
View user's profile Send private message Send e-mail
marty
Professional Member
Professional Member


Joined: 10 May 2001
Posts: 789

PostPosted: Wed Dec 04, 2002 1:59 am    Post subject: Reply with quote

Ok, I will change it, so I can get the returned numbers.

I will get back to you with that....

Thanks
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
marty
Professional Member
Professional Member


Joined: 10 May 2001
Posts: 789

PostPosted: Wed Dec 04, 2002 5:28 pm    Post subject: Reply with quote

Ok, after doing some tests with Tommy, Skit and Protected (Thanks guys) it seems the problem is with NON-ENGLISH systems only. And my DLL will but updated so its has its own option DECIMALSEP (Thanks Tommy for the hint). I didnt find a workaround in VDS. So to make it easier for everyone using that DLL, an update will be done ASAP.

Thanks guys.
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Wed Dec 04, 2002 5:43 pm    Post subject: Reply with quote

Is there a reason ya can't check the time format
returned and adjust it to decimal "."? I'm assuming
@media(duration,mMedia) etc. returns a float or
ya wouldn't be having this problem...
Code:

%t = @media(duration,mMedia)
%x = 1
REPEAT
  if @equal(@substr(%t, %x), ",")
     %t = @strdel(%t, %x)
     %t = @strins(%t, %x, ".")
  end
  %x = @succ(%x)
UNTIL @greater(%x, @len(%t))

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Wed Dec 04, 2002 5:47 pm    Post subject: Reply with quote

OOPS.. forgot a line, so if ya already checked the
code example, check it again. Embarassed

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
marty
Professional Member
Professional Member


Joined: 10 May 2001
Posts: 789

PostPosted: Wed Dec 04, 2002 6:48 pm    Post subject: Reply with quote

Mac,

It works like a charm now with your code sample... Thank you so much Wink

The VDS demo that comes with VDSMEDIA will be updated as well as the DLL with new functionnalities.


Last edited by marty on Wed Dec 04, 2002 6:56 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Wed Dec 04, 2002 6:52 pm    Post subject: Reply with quote

No problem Marty. Wink
_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Wed Dec 04, 2002 9:18 pm    Post subject: Reply with quote

Although you can work around the problem, the DLL should still return a decimal no matter what if you can do that.
No offense Marty but the users shouldn't have to work around anything.
If you can, how about sharing the Option DecimalSep-type DLL code at the Developer Forum.
Good luck Smile

_________________
-Sheep
My pockets hurt...
Back to top
View user's profile Send private message Send e-mail
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Wed Dec 04, 2002 9:35 pm    Post subject: Reply with quote

Ya prolly do basically the same thing in the DLL as the
workaround Sheep, check for a comma and replace it... Wink

BTW Marty, here's another (prolly faster) way to do that
in VDS, and doesn't use an extra var unless a comma is
found:
Code:

%t = @media(duration,mMedia)
if @greater(@pos(",", %t), 0)
   %p = @pos(",", %t)
   %t = @strdel(%t, %p)
   %t = @strins(%t, %p, ".")
   %p = ""
end

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Tommy
Admin Team


Joined: 16 Nov 2002
Posts: 746
Location: The Netherlands

PostPosted: Thu Dec 05, 2002 1:39 am    Post subject: Reply with quote

Although this is more related to Delphi than VDS, I'll post it here for clarity. All
that's needed to accomplish the same thing in Delphi is setting the special DecimalSeparator
variable to an appropriate character. I'll see about posting this on the developer forum
too.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group