It is currently September 1st, 2024, 1:08 am
Need help with uTorrent ETA conversion
-
- Posts: 13
- Joined: May 28th, 2010, 11:03 pm
- Location: Georgia
Need help with uTorrent ETA conversion
Is there a way to convert the ETA of a torrent in seconds to an ETA in Days:Hours:Minutes:Seconds? For example, if my uTorrent skin is returning an ETA for a torrent as 750628 seconds, is there a way to get the skin to display that as 8d 16h 30m 28s? I was thinking it could be done using the remainder or modulus operator in a calc measure but I can't figure out how to get it done. Thanks for any advice/help.
[hsimg]http://dl.dropbox.com/u/9795054/desktop.jpg[/hsimg]
-
- Moderator
- Posts: 995
- Joined: June 10th, 2009, 12:44 pm
- Location: Sweden
Re: Need help with uTorrent ETA conversion
Sure. You just need to know your clock and math and it's easy peasy.
Minutes
((ETA / 1000) - ((ETA / 1000) % 60)) /60
Seconds
(ETA / 1000) % 60 = 60 ? 0 : (ETA / 1000) % 60
Adapt for days and hours.
Most players use the same conversion.
Minutes
((ETA / 1000) - ((ETA / 1000) % 60)) /60
Seconds
(ETA / 1000) % 60 = 60 ? 0 : (ETA / 1000) % 60
Adapt for days and hours.
Most players use the same conversion.
I don't think, therefore I'm not.
-
- Posts: 13
- Joined: May 28th, 2010, 11:03 pm
- Location: Georgia
Re: Need help with uTorrent ETA conversion
Thanks Chewtoy that should help immensely. Out of curiosity, do you know where I can find more information on the math language that Rainmeter uses? I looked in the Manual and it wasn't all that helpful (in my opinion) as far as learning syntax and uses of symbols. For example, the Manual says % is the remainder or modulus operator but there aren't any examples showing someone new to the language how to use it.
[hsimg]http://dl.dropbox.com/u/9795054/desktop.jpg[/hsimg]
-
- Moderator
- Posts: 995
- Joined: June 10th, 2009, 12:44 pm
- Location: Sweden
Re: Need help with uTorrent ETA conversion
Not really.
You got the manual, like you said, but other than that nothing.
It sort of assumes that you have some knowledge of math and how to use different things.
A tutorial for some basic things with calcs might be in order, but there are endless possibilities on hoe to use calcs, so it might be tricky to cover everything.
But just a visual on how different operators are used might be helpful.
You got the manual, like you said, but other than that nothing.
It sort of assumes that you have some knowledge of math and how to use different things.
A tutorial for some basic things with calcs might be in order, but there are endless possibilities on hoe to use calcs, so it might be tricky to cover everything.
But just a visual on how different operators are used might be helpful.
I don't think, therefore I'm not.
-
- Posts: 13
- Joined: May 28th, 2010, 11:03 pm
- Location: Georgia
Re: Need help with uTorrent ETA conversion
A basic tutorial would be awesome. I am pretty good with math but not at coding it. GUI and .m files in Matlab are the extent of my math coding capabilities.
Ok, I tried your code and I think you wrote it to first convert milliseconds to seconds with the ETA/1000. So to try and teach myself some of the syntax etc. I made a new skin where I change the variable #time# (in seconds) and have your code w/o /1000 to tell me how many days, hours, minutes, and seconds it is. So far I am able to get the days and seconds to display the correct number. The hours and minutes however are just converting the input to hours and minutes without the remainder. The number I am using now is 185252 seconds which the skin should show as 2d 3h 27m 32s. Below is the code that is currently showing 2d 51h 3087m 32s.
I tried (((#time# - (#time# % 60))/3600)-(Calcdays*24)), (which should be 51-48=3), to get the correct number of hours but then it displayed 0h as if the syntax wasn't acceptable or something similar.
I'm stumped. Any ideas?
Ok, I tried your code and I think you wrote it to first convert milliseconds to seconds with the ETA/1000. So to try and teach myself some of the syntax etc. I made a new skin where I change the variable #time# (in seconds) and have your code w/o /1000 to tell me how many days, hours, minutes, and seconds it is. So far I am able to get the days and seconds to display the correct number. The hours and minutes however are just converting the input to hours and minutes without the remainder. The number I am using now is 185252 seconds which the skin should show as 2d 3h 27m 32s. Below is the code that is currently showing 2d 51h 3087m 32s.
I tried (((#time# - (#time# % 60))/3600)-(Calcdays*24)), (which should be 51-48=3), to get the correct number of hours but then it displayed 0h as if the syntax wasn't acceptable or something similar.
I'm stumped. Any ideas?
Code: Select all
[Variables]
time=185252
;Measures================================================================
[Calcdays]
Measure=calc
Formula=(#time# - (#time# % 60))/86400
[Calchrs]
Measure=calc
Formula=Calcdays % 1 = 0 ? 0 : (#time# - (#time# % 60))/3600
[Calcmin]
Measure=calc
Formula=Calchrs % 24 = 0 ? 0 : (#time# - (#time# % 60))/60
[Calcsec]
Measure=calc
Formula=#time# % 60
[hsimg]http://dl.dropbox.com/u/9795054/desktop.jpg[/hsimg]
-
- Posts: 13
- Joined: May 28th, 2010, 11:03 pm
- Location: Georgia
Re: Need help with uTorrent ETA conversion
Ok, after tinkering with the code in my previous post, I discovered that for some reason the numbers displayed are rounded. I tried multiplying the formula in [Calcdays] by 24 to make sure I would get 48 since the skin was showing 2 days. However when I refreshed the skin it showed 51 instead of 48 which means the remainder isn't getting subtracted like it should be and Rainmeter is just showing the rounded number of days, hours, and minutes.
Any ideas?
Any ideas?
[hsimg]http://dl.dropbox.com/u/9795054/desktop.jpg[/hsimg]
-
- Posts: 13
- Joined: May 28th, 2010, 11:03 pm
- Location: Georgia
Re: Need help with uTorrent ETA conversion
I should have tinkered some more before my last post. I think I figured it out. Atleast it is working for now it seems. This is the code I ended up with. If anyone sees any problems with the code or any special case scenarios that this code won't work for, please let me know and give me any input you can. Thanks for all your help Chewtoy. And thanks to everyone at Rainmeter for everything you do!!
Code: Select all
[Variables]
time=185252
[Calcdays]
Measure=calc
Formula=((#time# - (#time# % 86400))/86400)
[Calchrs]
Measure=calc
Formula=((#time# - (#time# % 3600))/3600)-(Calcdays*24)
[Calcmin]
Measure=calc
Formula=((#time# - (#time# % 60))/60)-((Calchrs*60)+(Calcdays*24*60))
[Calcsec]
Measure=calc
Formula=#time# % 60
[hsimg]http://dl.dropbox.com/u/9795054/desktop.jpg[/hsimg]