View Single Post
Old 05-22-2009, 11:02 PM   #369 (permalink)
hayroob
Administrator
 
hayroob's Avatar
 
Join Date: Mar 2008
Location: Detroitish
Posts: 1,654
Quote:
Originally Posted by TheGrundle View Post
Why all the if/then? Wouldn't something like this work? assuming timeSince = total seconds

days = timeSince \ 86400
hours = (timeSince \ 3600) - (days * 24)
minutes = (timeSince \ 60) - (days * 1440) - (hours * 60)
seconds = timeSince Mod 60


I've also done it differently in .NET

Code:
Public Function formatSecs(ByVal sSeconds As Long) As String  'Converts seconds to 0:00
        Dim tSpan As TimeSpan = New TimeSpan(0, 0, sSeconds)
        Dim sDate As DateTime = New DateTime(tSpan.Ticks)
        Return Int(tSpan.TotalHours) & sDate.ToString(":mm:ss")
End Function
Maybe you could do something similar with NSTimeDateFormatString

It just seems like a lot of code to me.
You are correct. I just sort of tossed in some code I had in the twitter segment because it didn't require me to turn on my brain.

all the ifs are now
Code:
int d = timeSince / 86400;
		int h = timeSince / 3600 - d * 24;
		int m = timeSince / 60 - d * 1440 - h * 60;
		int s = timeSince % 60;
Quote:
Originally Posted by yoav View Post
events feed you say... as in xml/json?
There's an xml feed of all the events, I'll PM it to you.
(Offline)   Reply With Quote