On 28/07/2009, at 19:50, Max Melcher wrote: > My 3g with os3 as another sample > valid samples taken: 20 > > counts per ms: 38.3 > > navigator.platform: iPhone > > itsa3GS: false > > itsa3G/2G: true > > itsaniPhone: true > > > > Am 28.07.2009 um 19:47 schrieb Jorge Chamorro <jorgechamo...@mac.com>: > >> >> On 28/07/2009, at 19:32, Stan Wiechers wrote: >> >>> Here are results from 2 phones >>> >>> 3G Phone: >>> >>> counts per ms: 46.6 >>> navigator.platform: iPhone >>> itsa3GS: false >>> >>> >>> 3GS Phone: >>> >>> valid samples taken: 16 >>> counts per ms: 111.625 >>> navigator.platform: iPhone >>> itsa3GS: true >>> itsa3G/2G: false >>> itsaniPhone: true >>>
Ok. Thanks. I think a good threshold could be 40 + (( 110 - 40) / 2 ) === 75 counts per ms. http://jorgechamorro.com/cljs/075/ the code is: var itsa3GS= (function () { function platformIsIphone () { if (window.navigator && (typeof window.navigator.platform === "string")) { return (window.navigator.platform.toLowerCase().indexOf("iphone") !== -1); } else { return false; } } function platformIsIphoneSimulator () { if (window.navigator && (typeof window.navigator.platform === "string")) { return (platformIsIphone() && (window.navigator.platform.toLowerCase().indexOf("simulator") !== -1)); } else { return false; } } function countsIn1ms () { var data= []; var maxTime= +new Date() +50; do { var t; var count= 0; var tt= +new Date(); do { t= +new Date(); } while (t === tt) do { count++; tt= +new Date(); } while (t === tt) if ((tt-t) === 1) { data[data.length]= count; } } while ((data.length < 20) && (t < maxTime)) var sum= 0; var n= data.length || 1; while (data.length) { sum+= data.pop(); } return sum/n; } var threshold= 75; return (platformIsIphone() && !platformIsIphoneSimulator() && (countsIn1ms() > threshold)); })(); -- Jorge. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "iPhoneWebDev" group. To post to this group, send email to iphonewebdev@googlegroups.com To unsubscribe from this group, send email to iphonewebdev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/iphonewebdev?hl=en -~----------~----~----~----~------~----~------~--~---