Skip to content

Commit aea2960

Browse files
committed
fix time too short (0s)
1 parent 1632c44 commit aea2960

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ Here is my workflow:
203203
3. Use `oam media local walk -au <path/to/local/data>` to generate a reference hash on the correct data (assuming data on your local drive is correct)
204204
4. Use `oam media <barcode> walk -au <path/to/ltfs>` to calculate the hash of files on tape, then store in the database.
205205
5. Use `oam file check -m local -m <barcode> -n 2` to exam if every file is matched. This command should have no output if everything is correct.
206-
6. Then copy the sample data to other two tapes. I keep 3 copies of the same data to ensure safety.
206+
6. Then copy the sample data to other two tapes and check. I keep 3 copies of the same data to ensure safety.
207207

208208
Tips:
209209
+ Using tools like TeraCopy, you can leave a checksum file on the tape. So I can check the file even I lost the database of this software.

src/main/kotlin/info/skyblond/oam/command/media/WalkCommand.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import org.jetbrains.exposed.sql.transactions.transaction
1919
import java.util.*
2020
import kotlin.io.path.fileSize
2121
import kotlin.io.path.relativeToOrNull
22+
import kotlin.math.max
2223

2324
object WalkCommand : CliktCommand(
2425
help = "Walk a given media to append, update or verify files."
@@ -95,7 +96,7 @@ object WalkCommand : CliktCommand(
9596
echo("[I]Calculating hash for $relativePathString")
9697
val t = System.currentTimeMillis() / 1000
9798
val hash = p.sha3(bufferSize * MB)
98-
val dt = System.currentTimeMillis() / 1000 - t
99+
val dt = max(1, System.currentTimeMillis() / 1000 - t)
99100
echo(
100101
"[I]Finished $relativePathString, " +
101102
"$dt s, ${size / 1024 / 1024 / dt} MB/s"

0 commit comments

Comments
 (0)