Usina BRAdvPL Guide
Sign in
← All topics
FUNCTIONUnder review

ElapTime

ElapTime( cHoraInicial, cHoraFinal ) --> cRet

Calculates a text interval between two times.

ElapTimeAdvPL
01 · OVERVIEW

Overview

ElapTime accepts eight-byte hh:mm:ss strings and returns the same format. Different lengths can raise a fatal error. When start exceeds end, the page describes adding 24 hours; this neither identifies dates nor resolves multiple days. The community example uses Sleep and Time, while this adaptation uses fixed values without waiting or reading the clock. (TOTVS, n.d., ref. 1)

02 · SYNTAX

Syntax

ElapTime( cHoraInicial, cHoraFinal ) --> cRet

Parameters

cHoraInicial
CharacterRequired

Start time hh:mm:ss.

cHoraFinal
CharacterRequired

End time hh:mm:ss.

Return value

Text hh:mm:ss interval.

03 · PRACTICAL EXAMPLE

Commented example

#Include "Protheus.ch"

User Function Ed360()
    // Two fixed valid time strings.
    ConOut(ElapTime("10:00:00", "10:01:30"))
Return Nil
Expected result

Expected result: 00:01:30. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

BEST PRACTICES
  • Validate format; wall-clock time is not a monotonic timer.
  • Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Related content

REFERENCES
  1. TOTVS. ElapTime. TDN. Accessed on 2026-10-26.
  2. EURAI. ADVPL/Funcoes/Hora/ELAPTIME.PRW. universo_do_desenvolvedor_site, commit a5c83e9490302bdb4a0fc5a9d92c2d569a60773c. Exemplo analisado. Accessed on 2026-10-26.
Status
Under review
Page created on
Last reviewed on
Original language
Portuguese
Reviewed by
Usina.BR
0 approved comment(s)

Comments

There are no approved comments yet.

Sign in with Google or Microsoft to comment.

Powered by Usina Docs · Alpha