Skip to content

Commit 2ce4b5b

Browse files
author
tom zhou
committed
fixed bench.cpp
1 parent 98dd3a5 commit 2ce4b5b

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

bench/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
all:
22
g++ -I../tweetnacl/ -o bench bench.cpp ../tweetnacl/tweetnacl.c
3+
4+
clean:
5+
rm -rf bench.exe bench

bench/bench.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,23 @@ int main(int argc, char *argv[]) {
4141
printf("\n\n\tstreess/%fkB: %d times\n", m0.length()/1000.0, t);
4242

4343
gettimeofday(&curTime, NULL);
44-
printf("secret box ...@%6.3f\n", curTime.tv_sec*1000 + (curTime.tv_usec / 1000));
44+
printf("secret box ...@%6.3f\n", curTime.tv_sec*1000.0 + (curTime.tv_usec / 1000.0));
4545

4646
unsigned char cab[crypto_secretbox_ZEROBYTES+m0.length()];
4747
crypto_secretbox((unsigned char *)cab, (unsigned char *)mb0, m0.length(), (unsigned char *)nonce, (unsigned char *)shk);
4848

4949
gettimeofday(&curTime, NULL);
50-
printf("... secret box@%6.3f\n", curTime.tv_sec*1000 + (curTime.tv_usec / 1000));
50+
printf("... secret box@%6.3f\n", curTime.tv_sec*1000.0 + (curTime.tv_usec / 1000.0));
5151

5252

5353
gettimeofday(&curTime, NULL);
54-
printf("\nsecret box open ...@%f\n", curTime.tv_sec*1000 + (curTime.tv_usec / 1000));
54+
printf("\nsecret box open ...@%6.3f\n", curTime.tv_sec*1000.0 + (curTime.tv_usec / 1000.0));
5555

5656
unsigned char mba[crypto_secretbox_ZEROBYTES+m0.length()];
5757
crypto_secretbox_open((unsigned char *)mba, (unsigned char *)(cab+16), 16+m0.length(), (unsigned char *)nonce, (unsigned char *)shk);
5858

5959
gettimeofday(&curTime, NULL);
60-
printf("... secret box open@%6.3f\n", curTime.tv_sec*1000 + (curTime.tv_usec / 1000));
60+
printf("... secret box open@%6.3f\n", curTime.tv_sec*1000.0 + (curTime.tv_usec / 1000.0));
6161
}
6262

6363
return 0;

bench/bench.exe

-94.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)