Jump to content

İndirilen Dosyanın Süresini Hesaplama


NotToday
 Share

Recommended Posts

Asağıdaki kodlarla hız toplam boyut ve indirilen boyutu labele yazdırdım.Fakat zamanı nasıl yazdırabilirim?

[code] local indirilen=string.format("%s",String.GetFormattedSize(tblData.Loaded, FMTSIZE_AUTOMATIC, true))
local topindirilen=string.format("%s",String.GetFormattedSize(tblData.Total, FMTSIZE_AUTOMATIC, true))
local hiz=string.format("%d Kb/s",tblData.CurrentSpeed)[/code]
Link to comment
Share on other sites

[b][color="#FF0000"]Global Function :[/color][/b]
[codebox]function ZamaniHesapla(hiz,boyut) -- Boyutu KB cinsinden Yazdırın
if hiz ~= "" and hiz ~= nil and boyut ~= "" and boyut ~= nil then
sSaniye = Math.Round(boyut/hiz, 0); -- Kaç Saniye
sDakika = 0;
sSaat = 0;
while sSaniye>59 do --Hesaplamaların Başlangıcı
sSaniye = sSaniye-60
sDakika = sDakika+1
if sDakika > 59 then -- 60 Olduğunda saate ekleme
sDakika = 0
sSaat = sSaat+1
end
end --Hesaplamaların Bitişi
if sDakika < 10 then -- 10dan Küçükse yanlarına 0 ekleme
sDakika = "0"..sDakika

end
if sSaniye < 10 then
sSaniye = "0"..sSaniye
end
if hiz > boyut then -- Hız Boyuttan Fazla İse 1 saniye olarak gösterir.
sSaniye = "01"
end
if sSaat < 10 then
sSaat = "0"..sSaat
end
return sSaat..":"..sDakika..":"..sSaniye ; -- En son Bu şekilde Çıktı Alınır.
end
end
[/codebox][b][color="#FF0000"]
Kullanımı: [/color][/b][color="#FF0000"][color="#000000"][code]sTime = ZamaniHesapla("10","100") -- 100 Boyut 10 Hız
Label.SetText("Label1", sTime);[/code]

Denedim Bende Çalıştı.. Bi hata yapmadysam yada birşeyi kaçırmadıysam çalışacaktır.
[/color][/color][b] [/b]

Edited by Kazım
Link to comment
Share on other sites

  • 2 hafta sonra ...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...