In Gamasutra's latest technical feature, XS2theWorld senior developer Sergio Giucastro examines the problems that game developers can encounter when trying to get time at the low level on Android devices. Giucastro points out that modern mobile platforms have extremely accurate hardware timers. "For example, ARM CPUs like the Cortex A9 (Samsung Galaxy SII) has a 64-bit Global Timer Counter Register -- that is a really accurate monotonic, non-decreasing clock, cheap to read." According to the Cortex A9 ARM Cycle Timing document, using the LDM instruction takes only one CPU cycle. You can use the exact same concept on the Tegra platform using reading memory mapped RTC (Real Time Clock) registers, too. "Timing using the Time Stamp Counter is really fast, but on some platforms it can be dangerous as well," notes Giucastro. "In [the] case of multi-core systems, or during the low frequency/CPU saving state of the system, it may lead to errors. You should beware this, and calibrate it with the PIT on some systems." He adds, "The nightmare begins when you realize that different platforms have different kind of RTC, and that besides this, a lot of different hardware clocks exists in modern platforms: Time Stamp Counter, Programmable Interval Timer, High Precision Event Timer, ACPI PMT." Giucastro says that direct hardware access means writing primitives specific to a single platform. "Furthermore, developing ASM code takes more time, is not portable, and is difficult to read for most developers. Finally, the OS can raise an exception if the hardware resource you are trying to access requires supervisor/kernel mode." The full feature, in which Sergio Giucastro goes more into depth on getting the most accurate, least resource-intensive timing calls on the Android platform, is live now on Gamasutra.
The nightmare of getting time at the low level on Android
June 6, 2012
Tags:
2012
Subscribe to our newsletter
About JikGuard.com
JikGuard.com, a high-tech security service provider focusing on game protection and anti-cheat, is committed to helping game companies solve the problem of cheats and hacks, and providing deeply integrated encryption protection solutions for games.
Top
New Phishing Campaign Abuses ConnectWise ScreenConnect to Take Over Devices
Aug. 27, 2025
New Data Theft Campaign Targets Salesforce via Salesloft App
Aug. 27, 2025
ENISA to Coordinate €36m EU-Wide Incident Response Scheme
Aug. 27, 2025
Citrix Patches Three NetScaler Zero Days as One Sees Active Exploitation
Aug. 27, 2025
ShadowSilk Campaign Targets Central Asian Governments
Aug. 27, 2025
Recent
New Phishing Campaign Abuses ConnectWise ScreenConnect to Take Over Devices
Aug. 27, 2025
New Data Theft Campaign Targets Salesforce via Salesloft App
Aug. 27, 2025
ENISA to Coordinate €36m EU-Wide Incident Response Scheme
Aug. 27, 2025
Citrix Patches Three NetScaler Zero Days as One Sees Active Exploitation
Aug. 27, 2025
ShadowSilk Campaign Targets Central Asian Governments
Aug. 27, 2025
Nevada “Network Security Incident” Shuts Down State Offices and Services
Aug. 27, 2025
Researchers Discover First Reported AI-Powered Ransomware
Aug. 27, 2025
CISA Strengthens Software Procurement Security With New Tool
Aug. 27, 2025
PlayStation CEO says firm is implementing measures to minimise impact of cancellations
Aug. 27, 2025
Ubisoft CEO Yves Guillemot summoned to appear before French court
Aug. 27, 2025
Blog
How Games Address In-App Purchase Hack
Nov. 4, 2025
H5 Mini-Game Encryption Solution
Oct. 30, 2025
How Card Games Address Cheating Issues
Oct. 28, 2025
UE Engine PAK Resource Encryption Solution
Oct. 23, 2025
Unity Revealed to Have Serious Security Vulnerabilities
Oct. 21, 2025
How Games Address Private Server Issues
Oct. 17, 2025
How Games Detect Auto Click Tools
Oct. 14, 2025
How Games Counter Cheat Engine Modifiers
Oct. 10, 2025
How Games Detect Malicious Hooks
Oct. 2, 2025
How to Encrypt Cocos Engine Games
Sept. 26, 2025
Random
Square Enix shutters two ten-year-old mobile games
Aug. 27, 2025
Part of the team behind EA's cancelled Black Panther game joins Wizards of the Coast
Aug. 27, 2025
Lightspeed Japan opens second studio in Osaka
Aug. 27, 2025
357,000 visitors attended Gamescom 2025
Aug. 26, 2025
Interpol-Led African Cybercrime Crackdown Leads to 1209 Arrests
Aug. 22, 2025
CISA Seeks Biden Era's SBOM Minimum Requirements Guideline Change
Aug. 25, 2025
Fake macOS Help Sites Seek to Spread Infostealer in Targeted Campaign
Aug. 25, 2025
Ubisoft CEO summoned to court in harassment case
Aug. 26, 2025
Phishing Campaign Uses UpCrypter to Deploy Remote Access Tools
Aug. 26, 2025
New MORTAL KOMBAT II Stills Feature Scorpion In Action And The Monstrous Baraka
Aug. 26, 2025
Most Views
How Games Detect GameGuardian
March 17, 2025
Explanation of Game Anti-Cheat Solutions
March 17, 2025
Cheat Engine Modifier Detection Solutions
March 18, 2025
Explanation of Unity Engine Encryption Solutions
March 17, 2025
How to Anti Hack in Client-Side Games
May 21, 2025
Cocos Engine Encryption Solution
April 8, 2025
How Games Anti-Debugging
April 15, 2025
Cloud Phone Detection Solution for Gaming
May 21, 2025
How Games Detect Frida
March 25, 2025
How Games Detect PlayCover
March 26, 2025