Exacto, era eso, en el php.ini lo tenía comentado.
Gracias a ambos.
DoEvents!
Gracias a ambos.
DoEvents!
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes Menú
Option Explicit
Private Declare Sub RtlMoveMemory Lib "kernel32" (ByVal pDst As Long, ByVal pSrc As Long, ByVal ByteLen As Long)
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Form_Load()
Dim t As New CTiming, c As New Class1, i&, r&, a$(), b As Boolean
Me.AutoRedraw = True
a() = Split("34:23:45 5:59:59 10:45:67 raulfeo 00:00:00 14:57:79 111:23:4", " ")
t.Reset
For i = 0 To 200000
For r = 0 To 6
b = IsHour_r338(a(r))
Next
Next
Me.Print t.sElapsed, "raul338"
Sleep 1000
t.Reset
For i = 0 To 200000
For r = 0 To 6
b = isHour_BlackZX(a(r))
Next
Next
Me.Print t.sElapsed, "Black"
Sleep 1000
t.Reset
For i = 0 To 200000
For r = 0 To 6
b = c.IsHour_Psyke12(a(r))
Next
Next
Me.Print t.sElapsed, , "Psyke13"
Set c = Nothing
Set t = Nothing
End Sub
'//En un módulo de clase.
Option Explicit
Private Declare Sub PutMem4 Lib "msvbvm60.dll" (ByVal Ptr&, ByVal Value&)
Private Declare Function VarPtrArray Lib "msvbvm60.dll" Alias "VarPtr" (Ptr() As Any) As Long
Private lngAscHeader&(5), intAsc%()
Public Static Function IsHour_Psyke12(ByRef sHour$) As Boolean
If LenB(sHour) = 16 Then
lngAscHeader(3) = StrPtr(sHour)
'//Check ":"
If intAsc(2) = 58 And intAsc(5) = 58 Then
'//Hours
If intAsc(0) < 48 Or intAsc(0) > 50 Then Exit Function
If intAsc(1) < 48 Then Exit Function
If intAsc(0) = 50 Then
If intAsc(1) > 51 Then Exit Function
Else
If intAsc(1) > 57 Then Exit Function
End If
'//Minutes
If intAsc(3) < 48 Or intAsc(3) > 53 Then Exit Function
If intAsc(4) < 48 Or intAsc(4) > 57 Then Exit Function
'//Seconds
If intAsc(6) < 48 Or intAsc(6) > 53 Then Exit Function
If intAsc(7) < 48 Or intAsc(7) > 57 Then Exit Function
IsHour_Psyke12 = True
End If
End If
End Function
Private Sub Class_Initialize()
lngAscHeader(0) = 1
lngAscHeader(1) = 2
lngAscHeader(4) = &H7FFFFFFF
PutMem4 VarPtrArray(intAsc), VarPtr(lngAscHeader(0))
End Sub
Private Sub Class_Terminate()
PutMem4 VarPtrArray(intAsc), 0
End Sub
Option Explicit
Private Sub Form_Load()
Dim c As New Class1
Debug.Print String$(50, "=")
Debug.Print c.IsHour_Psyke12(Time$) 'True
Debug.Print c.IsHour_Psyke12("23:59:59") 'True
Debug.Print c.IsHour_Psyke12("00:00:00") 'True
Debug.Print c.IsHour_Psyke12("34:54:13") 'False
Debug.Print c.IsHour_Psyke12("14:64:24") 'False
Debug.Print c.IsHour_Psyke12("22:07:70") 'False
Set c = Nothing
End Sub
==================================================
True
True
True
False
False
False
'//En un módulo de clase.
Option Explicit
Private oRegExp As Object
Public Static Function IsHour_Psyke13(ByRef sHour$) As Boolean
IsHour_Psyke13 = oRegExp.Test(sHour)
End Function
Private Sub Class_Initialize()
Set oRegExp = CreateObject("VBScript.RegExp")
With oRegExp
.Pattern = "^([01]\d|2[0-3])\:[0-5]\d\:[0-5]\d$"
.Global = True
End With
End Sub
Private Sub Class_Terminate()
Set oRegExp = Nothing
End Sub
Option Explicit
Private Sub Form_Load()
Dim c As New Class1
Debug.Print String$(50, "=")
Debug.Print c.IsHour_Psyke13(Time$) 'True
Debug.Print c.IsHour_Psyke13("23:59:59") 'True
Debug.Print c.IsHour_Psyke13("00:00:00") 'True
Debug.Print c.IsHour_Psyke13("34:54:13") 'False
Debug.Print c.IsHour_Psyke13("14:64:24") 'False
Debug.Print c.IsHour_Psyke13("22:07:70") 'False
Set c = Nothing
End Sub
==================================================
True
True
True
False
False
False
Option Explicit
Public Static Function IsHour_Psyke14(ByRef sHour$) As Boolean
Dim h As Byte, m As Byte, s As Byte
On Error GoTo NoHour:
If LenB(sHour) = 16 Then
If InStrB(1, ":", MidB$(sHour, 5, 2), vbBinaryCompare) = 0 Then Exit Function
If InStrB(1, ":", MidB$(sHour, 11, 2), vbBinaryCompare) = 0 Then Exit Function
h = LeftB$(sHour, 4) + 0
If h > 23 Then Exit Function
m = MidB$(sHour, 7, 4) + 0
If m > 59 Then Exit Function
s = RightB$(sHour, 4) + 0
If s > 59 Then Exit Function
IsHour_Psyke14 = True
End If
Exit Function
NoHour:
End Function
Option Explicit
Private Sub Form_Load()
Debug.Print String$(50, "=")
Debug.Print IsHour_Psyke14(Time$) 'True
Debug.Print IsHour_Psyke14("23:59:59") 'True
Debug.Print IsHour_Psyke14("00:00:00") 'True
Debug.Print IsHour_Psyke14("34:54:13") 'False
Debug.Print IsHour_Psyke14("14:64:24") 'False
Debug.Print IsHour_Psyke14("22:04:70") 'False
End Sub
==================================================
True
True
True
False
False
False
^([01]\d|2[0-3])\:[0-5]\d\:[0-5]\d$
Option Explicit
Public Static Function IsHour_Psyke1(ByRef sHour$) As Boolean
On Error Resume Next
IsHour_Psyke1 = TimeValue(sHour) And (LenB(sHour) = 16)
End Function
Private Sub Form_Load()
Debug.Print IsHour_Psyke1("12:13:12")
Debug.Print IsHour_Psyke1("24:13:12")
End Sub
True
False
Option Explicit
'// Acepta formatos: DD/MM/YYYY, D/MM/YYYY y DD/M/YYYY.
Public Static Function IsDate_Psyke12(ByRef sDate$) As Boolean
On Error Resume Next
IsDate_Psyke12 = InStrB(1, CDate(sDate), sDate, vbBinaryCompare)
End Function
Option Explicit
'// Acepta formatos: DD/MM/YYYY, D/MM/YYYY y DD/M/YYYY.
Public Static Function IsDate_Psyke13(ByRef sDate$) As Boolean
Dim lDay&, lMonth&, lYear&, lp1&
On Error GoTo DateError
lp1 = InStrB(1, sDate, "/", vbBinaryCompare)
If lp1 = 0 Then Exit Function
lYear = RightB$(sDate, 8)
lDay = LeftB$(sDate, lp1 - 1)
If lDay > 31 Then Exit Function
If lDay < 1 Then Exit Function
lMonth = MidB$(sDate, lp1 + 2, InStrB(lp1 + 1, sDate, "/", vbBinaryCompare) - lp1 - 2)
Select Case lMonth
Case Is > 12, Is < 1
Exit Function
Case 2
If lDay = 29 Then
IsDate_Psyke13 = ((lYear Mod &H4 = 0) And (lYear Mod &H64) Or (lYear Mod &H190 = 0))
Exit Function
ElseIf lDay > 29 Then
Exit Function
End If
Case Else
If lDay = 31 Then
Select Case lMonth
Case 1,3,5,7,8,10,12
IsDate_Psyke13 = True
End Select
Exit Function
End If
End Select
IsDate_Psyke13 = True
Exit Function
DateError:
End Function
Testeo de calidad
==============================
30/07/2000 Tenient101 FAILS
30/12/2011 Tenient101 FAILS
31/12/9999 $Edu$ FAILS
Testeo de velocidades
==============================
43,271 msec Ignorante v1.1
43,986 msec 79137913
21,627 msec BlackZeroX
60,085 msec $Edu$
20,118 msec Tenient101
27,267 msec Raul338
18,805 msec Psyke1
29,638 msec Psyke12
12,705 msec Psyke13
23,933 msec IsDate (función original de vb)