I just read an answer on StackOverflow with this code:

objectpascal Download
var
  eu:DWORD;
begin
  asm
    mov eax,[fs:$4]
    mov ebx,[fs:$8]
    sub eax,ebx
    mov eu,eax
  end;

  ShowMessage(IntToStr(eu));
end;

Unfortunately it lacked explanation, so what does this code do?

It reads offset $4 from the Thread Information Block (the top of stack) into eax and then offset $8 (stack base) into ebx.

Then it substracts the two and moves that into variable eu, that's all!