[tor-bugs] #4545 [TorBrowserButton]: torbutton_set_timezone() does not work (properly)

Tor Bug Tracker & Wiki torproject-admin at torproject.org
Thu Apr 26 06:10:04 UTC 2012


#4545: torbutton_set_timezone() does not work (properly)
------------------------------+---------------------------------------------
 Reporter:  gk                |          Owner:  mikeperry                    
     Type:  defect            |         Status:  new                          
 Priority:  major             |      Milestone:  TorBrowserBundle 2.2.x-stable
Component:  TorBrowserButton  |        Version:                               
 Keywords:                    |         Parent:                               
   Points:                    |   Actualpoints:                               
------------------------------+---------------------------------------------

Comment(by gk):

 No, I just meant that the saved offset string is wrong in those cases
 (that's why, I thought this ticket only describes minor issues). That said
 instead of
 {{{
   if(Math.floor(offset/60) < 10) {
     offStr += "0";
   }
   offStr += Math.floor(offset/60)+":";
   if((offset%60) < 10) {
     offStr += "0";
   }
   offStr += (offset%60);
 }}}
 something like
 {{{
    var minutes = offset % 60;
    // Division in JS gives always floating point results we do not want.
    // And Math.floor() is not working properly for negative values.
    if ((offset - minutes) / 60 < 10) {
      offStr += "0";
    }
    offStr += ((offset - minutes) / 60) + ":";
    if ((minutes) < 10) {
      offStr += "0";
    }
    offStr += (minutes);
 }}}
 should fix that "issue".

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/4545#comment:4>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list