惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Cisco Talos Blog
Cisco Talos Blog
阮一峰的网络日志
阮一峰的网络日志
云风的 BLOG
云风的 BLOG
D
Docker
Vercel News
Vercel News
IT之家
IT之家
Recent Announcements
Recent Announcements
Last Week in AI
Last Week in AI
V
Visual Studio Blog
Engineering at Meta
Engineering at Meta
腾讯CDC
Google DeepMind News
Google DeepMind News
I
InfoQ
博客园 - 三生石上(FineUI控件)
Apple Machine Learning Research
Apple Machine Learning Research
The GitHub Blog
The GitHub Blog
博客园 - Franky
The Cloudflare Blog
A
About on SuperTechFans
有赞技术团队
有赞技术团队
Y
Y Combinator Blog
T
Tenable Blog
P
Proofpoint News Feed
Recorded Future
Recorded Future
Security Latest
Security Latest
H
Hackread – Cybersecurity News, Data Breaches, AI and More
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
博客园 - 聂微东
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Google Online Security Blog
Google Online Security Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Simon Willison's Weblog
Simon Willison's Weblog
The Last Watchdog
The Last Watchdog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
N
News and Events Feed by Topic
TaoSecurity Blog
TaoSecurity Blog
U
Unit 42
The Hacker News
The Hacker News
Martin Fowler
Martin Fowler
T
Threat Research - Cisco Blogs
NISL@THU
NISL@THU
F
Full Disclosure
M
MIT News - Artificial intelligence
人人都是产品经理
人人都是产品经理
Hugging Face - Blog
Hugging Face - Blog
V
V2EX
Project Zero
Project Zero

博客园 - Blaze

eVC++就是eVC++啊 - Blaze - 博客园 VC++常用数据类型及其操作详解[徐兆元] From VB.NET to C# and Back Again [By Darren Neimke and Scott Mitchell ] 请不要做浮躁的人(老文了,还是转一下,共勉) 地球上最慢的网路不在巴布里亚新几内亚和尼泊尔之间,而在中国网通和电信之间! [翻译]用TcpClient建立GPRS连接 1年零2个月零25天 我回来了 .NET的Pascal--Chrome来了! Gmail疯了?50个邀请! 检举个博客园的Bug! INI配置文件的替代品-XML配置文件的操作 INI的替代品--XML配置文件读取与保存 Wallop下蛋送邀请。 从WebService的SessionID说起 Gmail下蛋了 udp的奇怪问题 webservice对"小"规模数据传输的效率问题 运动会痛苦经历 n个VB.Net C#代码转换工具
关于时间的加减计算
Blaze · 2004-10-16 · via 博客园 - Blaze

前几天论坛上有人问我时间加减运算的办法,也就是类似5:5+6:6=11:11。
于是有了代码:

        Dim temp_h, temp_m As Double
        
Select Case Op
            
Case "+"
                T2 = Split(TxtTime.Text, ":")
                
If T2.Length = 2 Then
                    temp_m 
= CDbl(T1(1)) + CDbl(T2(1))
                    temp_h 
= CDbl(T1(0)) + CDbl(T2(0))
                    
If temp_m >= 60 And temp_m < 120 Then
                        temp_h 
+= 1
                        temp_m 
-= 60
                        TxtTime.Text 
= CStr(temp_h) + ":" + CStr(temp_m)
                        ListBox1.Items.Add(TxtTime.Text)
                    
ElseIf temp_m >= 0 And temp_m < 60 Then
                        TxtTime.Text 
= CStr(temp_h) + ":" + CStr(temp_m)
                        ListBox1.Items.Add(TxtTime.Text)
                    
ElseIf temp_m >= 120 Then
                        
MsgBox("分钟数错误")
                    
End If
                
Else
                    
MsgBox("仅允许一个冒号")
                    Op 
= ""
                    Exit Sub
                
End If
            
Case "-"
                T2 = Split(TxtTime.Text, ":")
                
If T2.Length = 2 Then
                    temp_m 
= CDbl(T1(1)) - CDbl(T2(1))
                    temp_h 
= CDbl(T1(0)) - CDbl(T2(0))
                    
If temp_m < 0 And temp_m >= -60 Then
                        temp_h 
-= 1
                        temp_m 
+= 60
                        TxtTime.Text 
= CStr(temp_h) + ":" + CStr(temp_m)
                        ListBox1.Items.Add(TxtTime.Text)
                    
ElseIf temp_m >= 0 And temp_m < 60 Then
                        TxtTime.Text 
= CStr(temp_h) + ":" + CStr(temp_m)
                        ListBox1.Items.Add(TxtTime.Text)
                    
ElseIf temp_m <= -120 Then
                        
MsgBox("分钟数错误")
                    
End If
                
Else
                    
MsgBox("仅允许一个冒号")
                    Op 
= ""
                    Exit Sub
                
End If
            
Case ""
                    Exit Sub
        
End Select

不过有了新问题,类似7:85这样的非标准时间不能算,于是将加减代码换掉。可是新的问题又来了,他们想一次输入数据类似1:1+2:2+3:3= 一次计算。我有想到了原来写的一个表达式解析类。这个实在太复杂,正则表达式应该ok。徘徊中~~~