• MPL Timer Clarification

    From LEE WESTLAKE@2:250/6 to All on Sat Jan 15 11:40:53 2022
    Hi all,

    It's me again; I have the distinct impression I'm becoming a nuisance :)

    For the 'Timer' function, the MPL documentation states:

    -----------------------------------------------------------------------------

    Function TIMER : LongInt

    This function will return the current number of seconds which have passed
    since midnight. This function can be used to time how long a user is doing
    something.

    -----------------------------------------------------------------------------

    As such, may I assume the timer value rolls over from 86399 to 0 at midnight? If so, doesn't the delta between two readings require modulation in order to accommodate successive readings across this boundary?

    The example code implies a delta of "delta := time2 - time1", but shouldn't this be something like "delta := (time2 - time1 + 86400) % 86400"? This would have to be adjusted in order to account for Mystic's precedence rules, but you get the idea.

    I would have tested this, but I'm not overly familiar with Windows and my
    test box refuses to adjust its date/time - I've ticked/unticked all sorts of boxes, but the system just syncs right back to the correct settings.

    o-----------o------------o-------------------------o
    TALIADON | 2:250/6 | 21:3/138 | TALIADON-BBS@MAIL.COM | o-----------o-----------o------------o-------------------------o
    | "Error is a great teacher, and humility its hardest lesson." | o--------------------------------------------------------------o
    --- Mystic BBS v1.12 A46 2020/08/26 (Windows/32)
    * Origin: TALIADON BBS (2:250/6)
  • From g00r00@1:129/215 to LEE WESTLAKE on Tue Jan 18 12:33:27 2022
    Function TIMER : LongInt

    As such, may I assume the timer value rolls over from 86399 to 0 at midnight? If so, doesn't the delta between two readings require
    modulation in order to accommodate successive readings across this boundary?

    Yes both Timer and TimerMin would roll over at midnight and probably aren't all that useful for timing despite their function names lol.

    If you want to count seconds independant of a midnight rollover, you can use the "DateUnix" function which returns the number of seconds since Jan 1, 1970 and has no rollover.

    ... Honk if you love peace and quiet!

    --- Mystic BBS v1.12 A48 2022/01/14 (Windows/64)
    * Origin: Sector 7 * Mystic WHQ (1:129/215)
  • From LEE WESTLAKE@2:250/6 to g00r00 on Wed Jan 19 09:06:18 2022
    Yes both Timer and TimerMin would roll over at midnight and probably aren't all that useful for timing despite their function names lol.

    If you want to count seconds independant of a midnight rollover, you can use the "DateUnix" function which returns the number of seconds since
    Jan 1, 1970 and has no rollover.

    Thanks g00r00, very much appreciated.

    As a quick aside, are you able to clarify as to how the client IP may be accessed via MPL?

    o-----------o------------o-------------------------o
    TALIADON | 2:250/6 | 21:3/138 | TALIADON-BBS@MAIL.COM | o-----------o-----------o------------o-------------------------o
    | "Error is a great teacher, and humility its hardest lesson." | o--------------------------------------------------------------o
    --- Mystic BBS v1.12 A46 2020/08/26 (Windows/32)
    * Origin: TALIADON BBS (2:250/6)
  • From g00r00@1:129/215 to LEE WESTLAKE on Wed Jan 19 11:56:54 2022
    Thanks g00r00, very much appreciated.

    As a quick aside, are you able to clarify as to how the client IP may be accessed via MPL?

    Oh I am sorry I do remember someone (probably you) asking that and I must have forgot to answer. That happens sometimes so if/when it does just reask me again! ;)

    Probably the easiest way is to get it from the MCI codes using mci2str. The UY code returns the users IP address field and the UX returns their hostname.

    Var
    IP : String;
    Begin
    IP := mci2str('UY');
    WriteLn ('Your IP address is: " + IP);
    End.

    See if that helps you get what you're looking for!

    ... One tequila, two tequila, three tequila, floor.
    --- Mystic BBS v1.12 A48 2022/01/14 (Windows/64)
    * Origin: Sector 7 * Mystic WHQ (1:129/215)
  • From LEE WESTLAKE@2:250/6 to g00r00 on Wed Jan 19 18:46:37 2022
    Oh I am sorry I do remember someone (probably you) asking that and I
    must have forgot to answer. That happens sometimes so if/when it does just reask me again! ;)

    Probably the easiest way is to get it from the MCI codes using mci2str. The UY code returns the users IP address field and the UX returns their hostname.


    Brilliant, thanks g00r00; this is precisely what I'm looking for.

    o-----------o------------o-------------------------o
    TALIADON | 2:250/6 | 21:3/138 | TALIADON-BBS@MAIL.COM | o-----------o-----------o------------o-------------------------o
    | "Error is a great teacher, and humility its hardest lesson." | o--------------------------------------------------------------o
    --- Mystic BBS v1.12 A46 2020/08/26 (Windows/32)
    * Origin: TALIADON BBS (2:250/6)