Permalink
Browse files

[#976] Make strftime faster in one case

  • Loading branch information...
1 parent bc375ce commit 378c9ec6c4211b6263fdd1721ba0eed8f3a9d395 genywind committed Aug 19, 2009
Showing with 24 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +23 −0 rhodes/rhodes-framework/lib/dateME.rb
View
@@ -25,6 +25,7 @@ platform/wm/**/*.pch
platform/bb/.metadata/*
platform/bb/bin/*
+platform/bb/**/bin/*
platform/bb/target/*
platform/bb/build/LogFile.txt
platform/bb/*/.settings
@@ -2,7 +2,30 @@
class Time
+ def __makeTwoDigit(num)
+ str = num.to_s
+ if str.length < 2
+ str = '0' + str
+ end
+
+ str
+ end
+
def strftime(fmt='%F')
+
+ if fmt == "%m/%d/%Y, %I:%M%p"
+ strRes = ""
+ strPM = 'AM'
+ nHour = hour();
+ if nHour >= 12
+ strPM = 'PM'
+ nHour = nHour-12 if nHour > 12
+ end
+
+ strRes += __makeTwoDigit(mon()) + '/' + __makeTwoDigit(mday()) + '/' + year().to_s + ', ' + __makeTwoDigit(nHour) + ':' + __makeTwoDigit(min()) + strPM;
+ return strRes
+ end
+
DateTimeME.new(self.localtime).strftime(fmt)
end

0 comments on commit 378c9ec

Please sign in to comment.