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 to anti-debugging in PC Games
Sept. 16, 2025

iOS Trollstore Jailbreak-Free Cheating Solution
Sept. 12, 2025

How to Encrypt Unity AssetBundle Resources
Sept. 9, 2025

How games detect custom injection cheats
Sept. 5, 2025

Game Packet Capture Detection Solution
Sept. 2, 2025

How games counter dnSpy decompilation tool
Aug. 29, 2025

How games counter AssetStudio
Aug. 28, 2025

Single-Player Game Anti-Hack Solution Analysis
Aug. 21, 2025

How Games Counter IL2CppDumper Reverse Engineering
Aug. 20, 2025

Game Reverse Engineering Tools Analysis and Solutions
Aug. 15, 2025
Random

Apple Releases Patch for Likely Exploited Zero-Day Vulnerability
Aug. 22, 2025

"Performance didn't matter" in King layoffs, sources claim in new report
Aug. 27, 2025

New Phishing Campaign Abuses ConnectWise ScreenConnect to Take Over Devices
Aug. 27, 2025

Square Enix shutters two ten-year-old mobile games
Aug. 27, 2025

Ubisoft CEO Yves Guillemot summoned to appear before French court
Aug. 27, 2025

Resident Evil Requiem wins big at Gamescom Awards 2025
Aug. 26, 2025

Crystal Dynamics lays off "a number of talented colleagues"
Aug. 27, 2025

RETURN TO SILENT HILL: Check Out The First Teaser Trailer For Christophe Gans' Horror Sequel
Aug. 27, 2025

Report: King's leadership is 'skeptic' about AI mandate
Aug. 27, 2025

Attackers Abuse Virtual Private Servers to Compromise SaaS Accounts
Aug. 22, 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