11-02-2022, 06:43 PM
Print Using?
|
11-02-2022, 06:48 PM
Navigated to that link, and started to read that tutorial, and noticed "_RTRIM$". Maybe it should be "_TRIM$" (without the "R").
11-02-2022, 06:51 PM
Yeah I'm going through it now and wondered the same thing.
(11-02-2022, 06:48 PM)mnrvovrfc Wrote: Navigated to that link, and started to read that tutorial, and noticed "_RTRIM$". Maybe it should be "_TRIM$" (without the "R"). @TerryRitchie Good catch by mn, + 1. That should be changed in your tutorial when you can get around to it. Pete
11-02-2022, 09:22 PM
(11-02-2022, 06:54 PM)Pete Wrote:(11-02-2022, 06:48 PM)mnrvovrfc Wrote: Navigated to that link, and started to read that tutorial, and noticed "_RTRIM$". Maybe it should be "_TRIM$" (without the "R"). Whoops! Fixed it, thanks for catching that guys.
11-02-2022, 10:36 PM
(This post was last modified: 11-02-2022, 11:24 PM by Kernelpanic.)
Quote:SMcNeill - Simple solution: This solution is . . . smoother. But this: _Trim$(Str$(minute)) I have to take a good look at it again. Anyway, it took me some time to get your solution with Option _Explicit. About _Limit: If I understood that correctly, then _Limit 5 does not correspond to reality. There _Limit 2 comes closer to reality. Code: (Select All) 'Zeitanzeige. SMcNeill - 2. Nov. 2022
@Kernelpanic _LIMIT 5 simply says to run the program only 5 times in a second. If you want it to correspond closer to reality, then change the addition to + 0.2 instead of + 1.
(Just keep in mind, these are floating point values and thus are imprecise and will get ever so slightly further from the actual time, as time rolls by. If you need real precision here, make everything integers, add by 2, and divide by 10 only at the display point of the process. Remove floating points from the program completely, if absolute precision is needed.)
11-03-2022, 12:47 AM
(11-03-2022, 12:11 AM)SMcNeill Wrote: @Kernelpanic _LIMIT 5 simply says to run the program only 5 times in a second. If you want it to correspond closer to reality, then change the addition to + 0.2 instead of + 1. Thanks! I only noticed that the time is running out too fast. But if one really want it, or need it, your information is very helpful.
11-03-2022, 12:07 PM
(11-01-2022, 11:39 PM)james2464 Wrote: For a clock timer, I'm just wondering if there's a way to make the leading 0 appear when the time is 1:05 etc (I'm getting 1: 5)Back on topic, if solutions are still accepted. Resort to C/C++ for a solution. This is a C header file, call it "hourminsec.h" (without double-quotation marks). Code: (Select All) void hourminsec (short h, short m, short s, char * sout) This is the BASIC program, name it whatever you want, but place in the same directory as "hourminsec.h". Recommended both files on the same directory as QB64PE executable. Code: (Select All) declare library "hourminsec" The function is for convenience, in case you just want to get a string value. If you don't want hour just use "MID$()" starting with fourth character, like you have to do with "TIME$". I was going to suggest "strftime()" but that's more complicated if one doesn't want the "current time" returned as string. Otherwise it's just giving it "%H:%M:%S" as string input. There is an example program for it in the "man" page.
11-03-2022, 03:26 PM
(This post was last modified: 11-03-2022, 03:27 PM by Kernelpanic.)
Quote:mnrvovrfc - This is the BASIC program, name it whatever you want, but place in the same directory as "hourminsec.h". Recommended both files on the same directory as QB64PE executable. Thanks, the clock runs well. But even if both files are in the same directory, the full path must still be specified; at least at me. Code: (Select All) Declare Library "D:\Lab\QuickBasic64\Extern\Libraries\hourminsec" |
« Next Oldest | Next Newest »
|
Users browsing this thread: 2 Guest(s)