29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
-
+
-
-
+
+
-
+
-
+
-
-
+
+
-
+
|
(with-transaction
db
(lambda ()
(loop ((for m (up-from (/ one-year-ago 60) (to (/ now 60))))) ;; days of the year
(let ((thetime (* m 60))
(thehour (round (/ m 60))))
(let loop ((lastsec -1)
(sec (random 60))
(sec (pseudo-random-integer 60))
(count 0))
(if (> sec lastsec)
(exec (sql db "INSERT INTO alldat (event_time,var,val) VALUES (?,?,?)")
(+ thetime sec) ;; (* sec 60))
"stuff"
(if (even? thehour)
(random 1000)
(random 6))))
(pseudo-random-integer 1000)
(pseudo-random-integer 6))))
(if (< count 20)
(loop (max sec lastsec)(random 60)(+ count 1))))))))
(loop (max sec lastsec)(pseudo-random-integer 60)(+ count 1))))))))
(close-database db)
;; (with-transaction
;; db
;; (lambda ()
;; (loop ((for d (up-from 0 (to 365)))) ;; days of the year
;; (print "Day: " d)
;; (loop ((for h (up-from 1 (to 24))))
;; (loop ((for m (up-from 1 (to 60))))
;; (let ((thetime (+ beginning-2016 (* 365 24 60 60)(* h 60 60)(* m 60))))
;; (let loop ((lastsec -1)
;; (sec (random 60))
;; (sec (pseudo-random-integer 60))
;; (count 0))
;; (if (> sec lastsec)
;; (exec (sql db "INSERT INTO alldat (event_time,var,val) VALUES (?,?,?)")
;; (+ thetime sec) ;; (* sec 60))
;; "stuff"
;; (if (even? h)
;; (random 100)
;; (random 6))))
;; (pseudo-random-integer 100)
;; (pseudo-random-integer 6))))
;; (if (< count 20)
;; (loop (max sec lastsec)(random 60)(+ count 1))))))))))
;; (loop (max sec lastsec)(pseudo-random-integer 60)(+ count 1))))))))))
;;
;; (close-database db)
|