Home > Software engineering >  For help and search keywords in the Java output record files, calculate the time interval between ev
For help and search keywords in the Java output record files, calculate the time interval between ev

Time:09-17



Ask god to do a basic framework, thank you sincerely,
Event AA and CC is repeated, the need to look for in the text file to AA and CC each round of time, and time to do subtraction,
Before written only a few simple script, write a small program used to work for the first time,
Because only learned the basic VB, there are three difficulties:
1. How to capture events AA, CC in the front of the time parameter
2. How to ensure that the second query time parameter, starting from the first round position after the end of the query, not all queries,
3. The time parameter comparison (subtraction) how to do?

CodePudding user response:

Newly registered id, no points,
I'm sorry, I'm sorry

CodePudding user response:

Say "2." the first treatment:
Your map data samples, AA, BB, CC this is, in turn, the three events,
If by "every line of figures" as one element in the array of strings arrData (), then:
AA events corresponding subscript, it is 3 * n (n is "group number", n=0, 1, 2,... ),
And of the subscript CC events, it is 3 * n + 2 meanings ditto) of (n,
Means: AA events corresponding data is arrData (3 * n), CC event corresponding data is arrData (3 * n + 2),
If you read "the data of the file" of a string variable,
So only in instr () function "position by keyword to find" with Mid () function to intercept "row data,"

Say "1. Processing:
Output text "date and time" is the fixed format of alignment, no matter in what way "made 1 row data, you can use the Left () function,
The left 19 character content, with CDate () function converts "date value" (including time), used in "3." behind the processing,
However, this only support to "seconds", second decimal part cannot handle (so can only take the left 19 characters),
If necessary, can only alone with the decimal part,
If you only need to "time", you can use Mid () function, intercepting the "time of that paragraph of text,"

Your "3." meaning is not clear, I don't know what is the purpose of you,
But I just said above "CDate () function" transformation results, can be directly used in VB "relationship",
Another DateDiff () function can be used to "calculation date/time values", specific usage, you can baidu

CodePudding user response:

Supplementary note:
In using VB6 CDate () function converts the date/time text of "string format" into "date type value,"
Can only be used between the "date" in the text and/or space separated (space can have multiple, but every place up to 1/character),
So as I said in the second floor of the "string" to the left of the interception, still have to put the date in the "-" replace/or Spaces,
To as CDate () function of parameter transformation,

CodePudding user response:

Thank you very much for your reply,
Is the purpose of the article 3, in order to calculate the time interval between two events, such as AA to CC for how long,
And the first article, file in fact not only these three lines of repeated, mixed with many other record information among them, the purpose of software is from a large number of records (multiple log files) repeatedly scraping of the two events, and then calculate the time interval of each round, and then print it out,

CodePudding user response:

If use directly Cdate () at that time, "seconds" cannot take the decimal, time lag will be "plus or minus 1 second" error,
To "more accurate", then have to calculate time,
Or use CDate () + DateDiff () function calculation time, the reuse "of" the decimal part of data modification,

Even if there is a "multiple event", the gap between the AA and CC events uncertain,
If the "data" in an array of strings, can also according to the "index" to find out the corresponding "events in each group of data,"
  • Related