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

推荐订阅源

V
Vulnerabilities – Threatpost
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
WordPress大学
WordPress大学
Apple Machine Learning Research
Apple Machine Learning Research
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
月光博客
月光博客
P
Palo Alto Networks Blog
大猫的无限游戏
大猫的无限游戏
量子位
S
Secure Thoughts
博客园 - 【当耐特】
V
Visual Studio Blog
腾讯CDC
爱范儿
爱范儿
Webroot Blog
Webroot Blog
The Register - Security
The Register - Security
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Latest news
Latest news
Y
Y Combinator Blog
T
The Blog of Author Tim Ferriss
Cloudbric
Cloudbric
T
Troy Hunt's Blog
S
Security @ Cisco Blogs
B
Blog RSS Feed
I
Intezer
S
SegmentFault 最新的问题
N
News and Events Feed by Topic
云风的 BLOG
云风的 BLOG
C
CXSECURITY Database RSS Feed - CXSecurity.com
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Hacker News: Ask HN
Hacker News: Ask HN
Google DeepMind News
Google DeepMind News
TaoSecurity Blog
TaoSecurity Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Schneier on Security
Schneier on Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Recorded Future
Recorded Future
Google DeepMind News
Google DeepMind News
Forbes - Security
Forbes - Security
雷峰网
雷峰网
博客园 - 司徒正美
C
Cisco Blogs
S
Securelist
L
LINUX DO - 最新话题
P
Proofpoint News Feed
Blog — PlanetScale
Blog — PlanetScale
J
Java Code Geeks
N
News | PayPal Newsroom
N
News and Events Feed by Topic

博客园 - 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。徘徊中~~~