x=dispx : y=dispy screen 0,120,180,0,x-130,y-300 title "働いてるぜ!" gsel 0,-1 bgscr 3,20,20,0,x-20,y-80 dim a,6 : dim b,6 : dim d,6 repeat 4 : gettime a.cnt,cnt+3 : loop : gettime a.4,0 : gettime a.5,1 repeat 6 : d.cnt=a.cnt : loop str c6 : bload "st.lib",c6,1 : int c0 : int c1 : int c2 : int c3 : int c4 : int c5 : int c6 if c6=0 : gosub *firstget gsel 3,1 : cls 4 title "累計稼動時間集計中" font "MS ゴシック",15 : color 0,0,255 objsize 20,20 : objmode 2 : button "●",*call onexit *ending str c5 : str c6 : bload "day.lib",c5,5 : bload "day.lib",c6,,5 : int c5 : int c6 gettime b.4,0 : gettime b.5,1 : gettime b.0,3 if b.0!c5 {c5=b.0 : c6++} if c5<10 : c4=0 : else c4=1 str c5 : str c6 if c4=0 : c5="0"+c5 c5=""+c5+" "+c6 : bsave "day.lib",c5,10 gsel 0,-1 : cls 4 font "MS ゴシック",13 : color 255,255,0 : mes "今回の開始時間" pos 5,14 : mes ""+a.0+"日"+a.1+"時"+a.2+"分"+a.3+"秒" font "HG創英角ポップ体",16 : objsize 80,25 : objmode 2 pos 22,39 : button "経過時間",*nowview pos 22,72 : button "累計時間",*sumview pos 22,105 : button "稼動日数",*daysview pos 30,143 : font "MS ゴシック",20 : objsize 25,25 : objmode 2 : button "■",*recall pos 70,143 : font "HG正楷書体-PRO",20 : button "隠",*hide gsel 3,1 repeat 10 : wait 600 : loop gosub *sum *recall gsel 0,-1 : gsel 3,1 : cls 4 title "累計稼動時間集計中" font "MS ゴシック",15 : color 0,0,255 objsize 20,20 : objmode 2 : button "●",*call repeat 10 : wait 6000 : loop gosub *sum goto *recall stop *call gsel 3,-1 : gsel 0,1 : cls 4 font "MS ゴシック",13 : color 255,255,0 : mes "今回の開始時間" pos 5,14 : mes ""+a.0+"日"+a.1+"時"+a.2+"分"+a.3+"秒" font "HG創英角ポップ体",16 : objsize 80,25 : objmode 2 pos 22,39 : button "経過時間",*nowview pos 22,72 : button "累計時間",*sumview pos 22,105 : button "稼動日数",*daysview pos 30,143 : font "MS ゴシック",20 : objsize 25,25 : objmode 2 : button "■",*recall pos 70,143 : font "HG正楷書体-PRO",20 : button "隠",*hide repeat 10 : wait 6000 : loop gosub *sum goto *call stop *nowview cls 4 : font "MS ゴシック",13 : color 255,255,0 : mes "現在の連続稼動時間" repeat 4 : gettime b.cnt,cnt+3 : loop if b.0!a.0 : b.0=1 : else : b.0=0 b.1+=b.0*24 : b.1=b.1-a.1 : b.2+=b.1*60 : b.2=b.2-a.2 : b.3+=b.2*60 : b.3=b.3-a.3 b.2=b.3/60 : b.3=b.3\60 : b.1=b.2/60 : b.2=b.2\60 : b.0=b.1/24 : b.1=b.1\24 font "MS ゴシック",20 pos 30,30 : mes ""+b.0+"日間" : mes ""+b.1+"時間" : mes ""+b.2+"分間" : mes ""+b.3+"秒間" pos 45,130 : font "Impact",19 : objsize 30,30 : objmode 2 : button "OK",*call wait 1000 *nowview2 int c0 : int c1 : int c2 : int c3 font "MS ゴシック",20 repeat 600 gettime c0,3 : gettime c1,4 : gettime c2,5 : gettime c3,6 if c0!a.0 : c0=1 : else : c0=0 c1+=c0*24 : c1=c1-a.1 : c2+=c1*60 : c2=c2-a.2 : c3+=c2*60 : c3=c3-a.3 c2=c3/60 : c3=c3\60 : c1=c2/60 : c2=c2\60 : c0=c1/24 : c1=c1\24 redraw 2 if c0!b.0 {color 0,0,0 : boxf 30,30,100,50 : b.0=c0} ;日が違っていたらそこを消す if c1!b.1 {color 0,0,0 : boxf 30,50,100,70 : b.1=c1} ;時が違っていたらそこを消す if c2!b.2 {color 0,0,0 : boxf 30,70,100,90 : b.2=c2} ;分が違っていたらそこを消す color 0,0,0 : boxf 30,90,100,110 : color 255,255,0 ;秒を消す pos 30,30 : mes ""+c0+"日間" : mes ""+c1+"時間" : mes ""+c2+"分間" : mes ""+c3+"秒間" redraw 1 wait 100 : loop gosub *sum goto *nowview2 stop *sumview cls 4 : color 255,255,0 : font "MS ゴシック",14 : pos 1,0 : mes "累計時間" repeat 4 : gettime b.cnt,cnt+3 : loop : gettime b.4,0 : gettime b.5,1 int c5 : int c6 if (b.4\4=0) : c6=1 : else c6=0 ;うるう年チェック b.4=b.4-d.4 : b.5+=b.4*12 c5=b.5 b.5=b.5-d.5 if (c5=2)|(c5=4)|(c5=6)|(c5=8)|(c5=9)|(c5=11)|(c5=1) : b.0+=b.5*31 ;今が何月かで何日足すか違う if (c5=5)|(c5=7)|(c5=10)|(c5=12) : b.0+=b.5*30 if (c5=3)&(c6=0) : b.0+=b.5*28 if (c5=3)&(c6=1) : b.0+=b.5*29 b.0=b.0-d.0 : b.1+=b.0*24 b.1=b.1-d.1 : b.2+=b.1*60 b.2=b.2-d.2 : b.3+=b.2*60 b.3=b.3-d.3 b.2=b.3/60 : b.3=b.3\60 b.1=b.2/60 : b.2=b.2\60 b.0=b.1/24 : b.1=b.1\24 str c0 : str c1 : str c2 : str c3 bload "sum.lib",c1,2 : bload "sum.lib",c2,2,5 : bload "sum.lib",c3,2,10 : bload "sum.lib",c0,,15 int c0 : int c1 : int c2 : int c3 c0+=b.0 : c1+=b.1 : c2+=b.2 : c3+=b.3 if c3>59 {c2+=1 : c3-=60} if c2>59 {c1+=1 : c2-=60} if c1>23 {c0+=1 : c1-=24} pos 10,18 : mes ""+c0+"日間と" : pos 10,33 : mes ""+c1+"時間"+c2+"分"+c3+"秒" if c1<10 : b.1=0 : else b.1=1 if c2<10 : b.2=0 : else b.2=1 if c3<10 : b.3=0 : else b.3=1 str c1 : str c2 : str c3 : str c4 if b.1=0 : c1="0"+c1 if b.2=0 : c2="0"+c2 if b.3=0 : c3="0"+c3 c4=c1+" "+c2+" "+c3+" "+c0 : bsave "sum.lib",c4,20 repeat 4 : gettime d.cnt,cnt+3 : loop : gettime d.4,0 : gettime d.5,1 int c0 : int c1 : int c2 size=c0*24*60+(c1*60)+c2 str c0 : str c1 : str c2 : str c6 bload "st.lib",c0,4,5 : bload "st.lib",c1,5,10 : bload "st.lib",c2,5,15 bload "st.lib",c3,5,20 : bload "st.lib",c6,5,25 int c0 : int c1 : int c2 : int c3 : int c6 repeat 4 : gettime b.cnt,cnt+3 : loop gettime b.4,0 : gettime b.5,1 b.4=b.4-c0 : b.5+=b.4*12 b.5=b.5-c1 ;うるう年チェック ;1年以内なら、4で割り切れる年で今が2月以下ならOK、3月以上なら今月−何ヶ月が4以上ならOK、 gettime c0,0 : gettime c1,1 : c4=0 if (b.5<12)&(c0\4=0) : c5=1 : else : c5=0 if (b.5<12)&(c5=1)&(c1>2)&(c1-b.5<4) : c4=1 if (b.5<12)&(c5=0)&(c1=1)&(b.5=11) : c4=1 ;割り切れない年では今が1月で11ヶ月の時のみ、うるう年含む if (b.5>12)&(b.5<48)&((c0\4*12+c1-b.5)<3) : c4=1 ;1年以上4年未満なら最高1回しか含まない ;5年以上のときはうるう年無視 gosub *month if b.5=12 : b.0=b.0+365+c4 ;12ヶ月なら365。閏年ならもう1日 if b.5>12 {c5=b.5/12 : b.0+=c5*365 : b.0+=c5/4 : b.5=b.5\12} : else : b.5=0 ;13ヶ月以上なら12で割って gosub *month ;1〜11ヶ月と同じ計算をする。 b.0=b.0-c2 : b.1+=b.0*24 : b.1=b.1-c3 : b.2+=b.1*60 : b.2=b.2-c6 if (b.2>0)&(size<214749) {b.0=size*10000/b.2 b.1=b.0/100 : b.4=b.0\100/10 : b.3=b.0\10 pos 1,55 : mes "稼動率 "+b.1+"."+b.4+b.3+"%"} if (b.2>0)&(size>214748) {b.2=b.2/10 : b.0=size*1000/b.2 ;149日間3時間9分を超えると b.1=b.0/100 : b.4=b.0\100/10 : b.3=b.0\10 ;計算方法を変えなければならなくなる pos 1,55 : mes "稼動率 "+b.1+"."+b.4+b.3+"%"} font "MS ゴシック",13 b.4=0 b.1=b.0*24/1000 : b.2=b.1/10 : b.3=b.1\10 if b.1>0 {pos 5,75 : mes "1日の稼動時間は" : mes "約"+b.2+"."+b.3+"時間です" : b.4=1} b.1=0 if (b.0>0)&(b.4=0) : b.1=10000/b.0/24 if b.1>1 {pos 5,75 : mes ""+b.1+"日に1時間" : pos 23,88 : mes "稼動しています"} pos 23,115 : font "HG創英角ポップ体",16 : objsize 78,26 : objmode 2 : button "雪だるま",*daruma pos 48,151 : objsize 30,20 : objmode 2 : button "OK",*call repeat 10 : wait 6000 : loop gosub *sum goto *sumview stop *daruma cls 4 : size=size/1500+15 : color 255,255,255 pos 55-(size/2),75-(size/2) : font "MS ゴシック",size : mes "●" pos 55-(size*2/5),75-size : font "MS ゴシック",size*4/5+1 : mes "●" color 0,0,0 pos 55-(size/3),75-(size*5/6) : font "MS ゴシック",size/2-6 : mes "・" pos 57-(size/6),75-(size*5/6) : font "MS ゴシック",size/2-6 : mes "・" color 200,200,200 : boxf 0,120,120,180 pos 30,150 : font "HG創英角ポップ体",17 : objmode 2 : button "OK",*sumview repeat 10 : wait 6000 : loop gosub *sum goto *daruma stop *daysview cls 4 : color 255,255,0 : font "MS ゴシック",13 str c0 : str c1 : str c2 : str c3 : str c4 : str c5 bload "st.lib",c0,4,5 : bload "st.lib",c1,5,10 : bload "st.lib",c2,5,15 bload "st.lib",c3,5,20 : bload "st.lib",c4,5,25 : bload "st.lib",c5,5,30 int c0 : int c1 : int c2 : int c3 : int c4 : int c5 pos 1,0 : mes "開始日" font "MS ゴシック",14 pos 5,15 : mes ""+c0+"年"+c1+"月"+c2+"日" pos 20,30 : mes ""+c3+"時"+c4+"分"+c5+"秒" str c5 : str c6 : bload "day.lib",c5,5 : bload "day.lib",c6,,5 : int c5 : int c6 gettime b.4,0 : gettime b.5,1 : gettime b.0,3 if b.0!c5 {c5=b.0 : c6++} pos 1,48 : mes "稼動日数 "+c6+"日目" if c5<10 : c4=0 : else c4=1 str c5 : str c6 if c4=0 : c5="0"+c5 c5=""+c5+" "+c6 : bsave "day.lib",c5,10 str c0 : str c1 : str c2 bload "st.lib",c0,4,5 : bload "st.lib",c1,2,10 : bload "st.lib",c2,2,15 int c0 : int c1 : int c2 : int c5 : int c6 b.4=b.4-c0 : b.5+=b.4*12 b.5=b.5-c1 gettime c0,0 : gettime c1,1 : c4=0 if (b.5<12)&(c0\4=0) : c3=1 : else : c3=0 if (b.5<12)&(c3=1)&(c1>2)&(c1-b.5<4) : c4=1 if (b.5<12)&(c3=0)&(c1=1)&(b.5=11) : c4=1 if (b.5>12)&(b.5<48)&((c0\4*12+c1-b.5)<3) : c4=1 gosub *month if b.5=12 : b.0=b.0+365+c4 if b.5>12 {c5=b.5/12 : b.0+=c5*365 : b.0+=c5/4 : b.5=b.5\12} : else : b.5=0 gosub *month b.0=b.0-c2+1 font "MS ゴシック",12 : pos 1,66 : mes "開始日からの日数" font "MS ゴシック",14 : pos 64,80 : mes ""+b.0+"日目" c6=c6*10000/b.0 : c4=c6/100 : c5=c6\100/10 : c6=c6\10 pos 1,100 : mes "起動確率 "+c4+"."+c5+c6+"%" pos 50,145 : font "HG創英角ポップ体",15 : objsize 30,20 : objmode 2 : button "OK",*call repeat 10 : wait 6000 : loop gosub *sum goto *daysview stop *hide gsel 0,-1 size=0 repeat 240 : b.0=0 : b.1=0 getkey b.0,17 wait 250 getkey b.1,17 if (b.0+b.1)=2 {size=1 : break} loop gosub *sum if size=1 : goto *call goto *hide *sum str c5 : str c6 : bload "day.lib",c5,5 : bload "day.lib",c6,,5 : int c4 : int c5 : int c6 repeat 4 : gettime b.cnt,cnt+3 : loop : gettime b.4,0 : gettime b.5,1 if b.0!c5 {c5=b.0 : c6++} if c5<10 : c4=0 : else c4=1 str c5 if c4=0 : c5="0"+c5 c5=""+c5+" "+c6 : bsave "day.lib",c5,10 if b.0!d.0 : b.0=1 : else : b.0=0 b.1+=b.0*24 : b.1=b.1-d.1 : b.2+=b.1*60 : b.2=b.2-d.2 : b.3+=b.2*60 : b.3=b.3-d.3 b.2=b.3/60 : b.3=b.3\60 : b.1=b.2/60 : b.2=b.2\60 : b.0=b.1/24 : b.1=b.1\24 repeat 4 : gettime d.cnt,cnt+3 : loop : gettime d.4,0 : gettime d.5,1 : wait 20 str c0 : str c1 : str c2 : str c3 bload "sum.lib",c1,2 : bload "sum.lib",c2,2,5 : bload "sum.lib",c3,2,10 : bload "sum.lib",c0,,15 int c0 : int c1 : int c2 : int c3 : wait 20 c0+=b.0 : c1+=b.1 : c2+=b.2 : c3+=b.3 if c3>59 {c2+=1 : c3-=60} if c2>59 {c1+=1 : c2-=60} if c1>23 {c0+=1 : c1-=24} if c1<10 : b.1=0 : else b.1=1 if c2<10 : b.2=0 : else b.2=1 if c3<10 : b.3=0 : else b.3=1 str c1 : str c2 : str c3 : str c4 : wait 10 if b.1=0 : c1="0"+c1 if b.2=0 : c2="0"+c2 if b.3=0 : c3="0"+c3 c4=c1+" "+c2+" "+c3+" "+c0 : wait 10 bsave "sum.lib",c4,20 : wait 50 return *month if b.5=1 { if (c1=2)|(c1=4)|(c1=6)|(c1=8)|(c1=9)|(c1=11)|(c1=1) {b.0+=31} if (c1=5)|(c1=7)|(c1=10)|(c1=12) {b.0+=30} if c1=3 {b.0=b.0+28+c4} } if b.5=2 { if (c1=1)|(c1=5)|(c1=6)|(c1=7)|(c1=8)|(c1=10)|(c1=11)|(c1=12) {b.0+=61} if (c1=2)|(c1=9) {b.0+=62} if (c1=3)|(c1=4) {b.0=b.0+59+c4} } if b.5=3 { if (c1=1)|(c1=2)|(c1=6)|(c1=8)|(c1=9)|(c1=10)|(c1=11) {b.0+=92} if (c1=7)|(c1=12) {b.0+=91} if (c1=3)|(c1=4)|(c1=5) {b.0=b.0+90+c4-(c1/5)} } if b.5=4 { if (c1=1)|(c1=7)|(c1=8)|(c1=10)|(c1=12) {b.0+=122} if (c1=2)|(c1=9)|(c1=11) {b.0+=123} if (c1=3)|(c1=5)|(c1=6) {b.0=b.0+120+c4} if c1=4 {b.0=b.0+121+c4} } if b.5=5 { if (c1=1)|(c1=2)|(c1=8)|(c1=9)|(c1=10)|(c1=11)|(c1=12) {b.0+=153} if (c1>2)&(c1<8) {b.0=b.0+151+c4-(c1/7)} } if b.5=6 { if (c1=1)|(c1=2)|(c1=9)|(c1=11) {b.0+=184} if (c1=10)|(c1=12) {b.0+=183} if (c1=3)|(c1=5)|(c1=7)|(c1=8) {b.0=b.0+181+c4} if (c1=4)|(c1=6) {b.0=b.0+182+c4} } if b.5=7 { if (c1>2)&(c1<10) {b.0=b.0+212+c4} if (c1=1)|(c1=10)|(c1=11)|(c1=12) {b.0+=214} if c1=2 {b.0+=215} } if b.5=8 { if (c1=3)|(c1=4)|(c1=6)|(c1=8)|(c1=9) {b.0=b.0+243+c4} if (c1=5)|(c1=7)|(c1=10) {b.0=b.0+242+c4} if (c1=1)|(c1=2)|(c1=11)|(c1=12) {b.0=b.0+245-(c1/12)} } if b.5=9 { if (c1=3)|(c1=5)|(c1=6)|(c1=7)|(c1=8)|(c1=10)|(c1=11) {b.0=b.0+273+c4} if (c1=4)|(c1=9) {b.0=b.0+274+c4} if (c1=1)|(c1=2)|(c1=12) {b.0=b.0+276-(c1\2)} } if b.5=10 { if (c1=3)|(c1=4)|(c1=5)|(c1=6)|(c1=8)|(c1=9)|(c1=10)|(c1=11) {b.0=b.0+304+c4} if (c1=7)|(c1=12) {b.0=b.0+303+c4} if (c1=1)|(c1=2) {b.0+=306} } if b.5=11 { if (c1=1)|(c1=3)|(c1=5)|(c1=7)|(c1=8)|(c1=10)|(c1=12) {b.0+=334+c4} if (c1=4)|(c1=6)|(c1=9)|(c1=11) {b.0+=335+c4} if c1=2 {b.0=b.0+337} } return *ending str c5 : str c6 : bload "day.lib",c5,5 : bload "day.lib",c6,,5 : int c4 : int c5 : int c6 repeat 4 : gettime b.cnt,cnt+3 : loop : gettime b.4,0 : gettime b.5,1 if b.0!c5 {c5=b.0 : c6++} if c5<10 : c4=0 : else c4=1 str c5 if c4=0 : c5="0"+c5 c5=""+c5+" "+c6 : bsave "day.lib",c5,10 if b.0!d.0 : b.0=1 : else : b.0=0 b.1+=b.0*24 : b.1=b.1-d.1 b.2+=b.1*60 : b.2=b.2-d.2 b.3+=b.2*60 : b.3=b.3-d.3 b.2=b.3/60 : b.3=b.3\60 b.1=b.2/60 : b.2=b.2\60 b.0=b.1/24 : b.1=b.1\24 str c0 : str c1 : str c2 : str c3 bload "sum.lib",c1,2 bload "sum.lib",c2,2,5 bload "sum.lib",c3,2,10 bload "sum.lib",c0,,15 int c0 : int c1 : int c2 : int c3 c0+=b.0 : c1+=b.1 : c2+=b.2 : c3+=b.3 if c3>59 {c2+=1 : c3-=60} if c2>59 {c1+=1 : c2-=60} if c1>23 {c0+=1 : c1-=24} if c1<10 : b.1=0 : else b.1=1 if c2<10 : b.2=0 : else b.2=1 if c3<10 : b.3=0 : else b.3=1 str c0 : str c1 : str c2 : str c3 : str c4 if b.1=0 : c1="0"+c1 if b.2=0 : c2="0"+c2 if b.3=0 : c3="0"+c3 c4=c1+" "+c2+" "+c3+" "+c0 bsave "sum.lib",c4,20 end *firstget c0=a.4 : c1=a.5 : c2=a.0 : c3=a.1 : c4=a.2 : c5=a.3 if c1<10 : b.1=0 : else b.1=1 if c2<10 : b.2=0 : else b.2=1 if c3<10 : b.3=0 : else b.3=1 if c4<10 : b.4=0 : else b.4=1 if c5<10 : b.5=0 : else b.5=1 str c0 : str c1 : str c2 : str c3 : str c4 : str c5 : str c6 if b.1=0 : c1="0"+c1 if b.2=0 : c2="0"+c2 if b.3=0 : c3="0"+c3 if b.4=0 : c4="0"+c4 if b.5=0 : c5="0"+c5 c6="1 "+c0+" "+c1+" "+c2+" "+c3+" "+c4+" "+c5 : bsave "st.lib",c6,32 c6=""+c2+" 1" : bsave "day.lib",c6,10 return