Code:
typedef int (__cdecl *tGetSpellCooldownByID)(int, int, DWORD*, DWORD*, DWORD*);
tGetSpellCooldownByID GetSpellCooldownByID= (tGetSpellCooldownByID)0x00809000; // Spell_C__GetSpellCooldown_Proxy in the info thread
typedef int (__cdecl *tGetTimer)();
tGetTimer GetTimer = (tGetTimer)0x0086AE20; // PerformanceCounter in the info thread
DWORD cdLength=0, timeStarted=0, enabled=0, RemainingCD = 0;
GetSpellCooldownByID(<spell id>, 0, &cdLength, &timeStarted, &enabled);
if(cdLength > 0)
RemainingCD = (timeStarted+cdLength)-GetTimer();
Call it with a no-cd instant spell to get the remaining gcd. If remaining gcd > 0 then cdLength is the total length of the gcd.
If you're silenced then it will give you that cooldown instead of the gcd. Depending on what you want that might be either good or bad 
Edit:
Didn't see Nesox' post while I was writing this.. That might be closer to what you're asking for.