If I declare time-strings in UDT as:
DateTime_iso8601 As ZString * 128
DateTime_RFC7231 As ZString * 128
then Print will print blank time-strings
but if I replace zString * NNN with String its working OK:
DateTime_iso8601 As String
DateTime_RFC7231 As String
Where i'm wrong?
Code: Select all
Dim Shared As tagSourceAccess Ptr pGlobal_C
pGlobal_C = New tagSourceAccess[iCount]
For i As ULong = 1 To iCount
pGlobal_C[i].Import(i)
pGlobal_C[i].Setup()
' blank with zString * 128 and correct with String
Print "sDateTime_UTC_iso8601 = ";pGlobal_C[i].DateTime_iso8601
Print "sDateTime_UTC_RFC7231 = ";pGlobal_C[i].DateTime_RFC7231
Next i
Code: Select all
' .............................................................................................................................
Type tagSourceAccess
iError As Long
iExtended As Long
iID As ULong
Name As ZString * 2048
DateTime_EPOCH As LongInt
DateTime_iso8601 As ZString * 128
DateTime_RFC7231 As ZString * 128
DateTime_GDateTime As GDateTime Ptr
Declare Function Import(iID As ULong) As Long
Declare Function Export() As Long
Declare Function Compare() As Long
Declare Function Setup() As Long
Declare Sub DebugPrint()
Declare Constructor()
Declare Constructor(ByRef tSourceAccess As tagSourceAccess)
Declare Operator Let (ByRef tSourceAccess As tagSourceAccess)
Declare Destructor ()
End Type
' .............................................................................................................................
Function tagSourceAccess.Import(iID As ULong) As Long
This.iID = iID
This.name = asGlobal(iID).name
This.DateTime_EPOCH = asGlobal(iID).DateTime_EPOCH
' ----------------------------------------------------------------------------------------
DateTimeParse_EPOCHToAll(This.DateTime_EPOCH, _
This.DateTime_iso8601, _
This.DateTime_RFC7231, _
This.DateTime_GDateTime)
' ----------------------------------------------------------------------------------------
'
' this print blank time-strings <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
'
' ----------------------------------------------------------------------------------------
Print "sDateTime_UTC_iso8601 = ";This.DateTime_iso8601
Print "sDateTime_UTC_RFC7231 = ";This.DateTime_RFC7231
' ----------------------------------------------------------------------------------------
This.iError = SourceAccess_OK
This.iExtended = SourceAccess_ExtOK
' ----------------------------------------------------------------------------------------
Function = SourceAccess_OK
End Function
' .............................................................................................................................
' .............................................................................................................................
Function DateTimeParse_EPOCHToAll(ByRef iDateTime_Epoch As LongInt, _
ByRef sDateTime_UTC_iso8601 As String, _
ByRef sDateTime_UTC_RFC7231 As String, _
ByRef GDateTime_UTC_Base As GDateTime Ptr) As Integer
' ----------------------------------------------------------------------------------------
sDateTime_UTC_iso8601 = Space(128)
sDateTime_UTC_RFC7231 = Space(128)
GDateTime_UTC_Base = 0
' ----------------------------------------------------------------------------------------
'Print "PubDate in = ";sDateTime_SourceRFC7231
Dim GDateTime_Base As GDateTime Ptr
Dim GDateTime_Val As GTimeVal
Dim RetValue As Boolean
Dim As gchar Ptr Pattern_Local_iso8601 = @"%Y-%m-%dT%H:%M:%S%:z", Pattern_Local_RFC7231 = @"%a, %d %b %Y %H:%M:%S%z"
Dim As gchar Ptr Pattern_UTC_iso8601 = @"%Y-%m-%dT%H:%M:%S %Z", Pattern_UTC_RFC7231 = @"%a, %d %b %Y %H:%M:%S %Z"
' ----------------------------------------------------------------------------------------
If iDateTime_Epoch > 0 Then
GDateTime_UTC_Base = g_date_time_new_from_unix_utc (iDateTime_Epoch)
Else
GDateTime_UTC_Base = g_date_time_new_now_utc()
EndIf
' ----------------------------------------------------------------------------------------
sDateTime_UTC_iso8601 = *g_date_time_format (GDateTime_UTC_Base,Pattern_UTC_iso8601)
sDateTime_UTC_RFC7231 = *g_date_time_format (GDateTime_UTC_Base,Pattern_UTC_RFC7231)
' ----------------------------------------------------------------------------------------
'
' this print correct time-strings <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
'
' ----------------------------------------------------------------------------------------
Print "sDateTime_UTC_iso8601 = ";sDateTime_UTC_iso8601
Print "sDateTime_UTC_RFC7231 = ";sDateTime_UTC_RFC7231
' ----------------------------------------------------------------------------------------
Return 0
End Function
Code: Select all
' .............................................................................................................................
Type tagSourceAccess
iError As Long
iExtended As Long
iID As ULong
Name As ZString * 2048
DateTime_EPOCH As LongInt
DateTime_iso8601 As String
DateTime_RFC7231 As String
DateTime_GDateTime As GDateTime Ptr
Declare Function Import(iID As ULong) As Long
Declare Function Export() As Long
Declare Function Compare() As Long
Declare Function Setup() As Long
Declare Sub DebugPrint()
Declare Constructor()
Declare Constructor(ByRef tSourceAccess As tagSourceAccess)
Declare Operator Let (ByRef tSourceAccess As tagSourceAccess)
Declare Destructor ()
End Type
' .............................................................................................................................
Function tagSourceAccess.Import(iID As ULong) As Long
This.iID = iID
This.name = asGlobal(iID).name
This.DateTime_EPOCH = asGlobal(iID).DateTime_EPOCH
' ----------------------------------------------------------------------------------------
DateTimeParse_EPOCHToAll(This.DateTime_EPOCH, _
This.DateTime_iso8601, _
This.DateTime_RFC7231, _
This.DateTime_GDateTime)
' ----------------------------------------------------------------------------------------
'
' this print correct time-strings <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
'
' ----------------------------------------------------------------------------------------
Print "sDateTime_UTC_iso8601 = ";This.DateTime_iso8601
Print "sDateTime_UTC_RFC7231 = ";This.DateTime_RFC7231
' ----------------------------------------------------------------------------------------
This.iError = SourceAccess_OK
This.iExtended = SourceAccess_ExtOK
' ----------------------------------------------------------------------------------------
Function = SourceAccess_OK
End Function
' .............................................................................................................................
' .............................................................................................................................
Function DateTimeParse_EPOCHToAll(ByRef iDateTime_Epoch As LongInt, _
ByRef sDateTime_UTC_iso8601 As String, _
ByRef sDateTime_UTC_RFC7231 As String, _
ByRef GDateTime_UTC_Base As GDateTime Ptr) As Integer
' ----------------------------------------------------------------------------------------
sDateTime_UTC_iso8601 = Space(128)
sDateTime_UTC_RFC7231 = Space(128)
GDateTime_UTC_Base = 0
' ----------------------------------------------------------------------------------------
'Print "PubDate in = ";sDateTime_SourceRFC7231
Dim GDateTime_Base As GDateTime Ptr
Dim GDateTime_Val As GTimeVal
Dim RetValue As Boolean
Dim As gchar Ptr Pattern_Local_iso8601 = @"%Y-%m-%dT%H:%M:%S%:z", Pattern_Local_RFC7231 = @"%a, %d %b %Y %H:%M:%S%z"
Dim As gchar Ptr Pattern_UTC_iso8601 = @"%Y-%m-%dT%H:%M:%S %Z", Pattern_UTC_RFC7231 = @"%a, %d %b %Y %H:%M:%S %Z"
' ----------------------------------------------------------------------------------------
If iDateTime_Epoch > 0 Then
GDateTime_UTC_Base = g_date_time_new_from_unix_utc (iDateTime_Epoch)
Else
GDateTime_UTC_Base = g_date_time_new_now_utc()
EndIf
' ----------------------------------------------------------------------------------------
sDateTime_UTC_iso8601 = *g_date_time_format (GDateTime_UTC_Base,Pattern_UTC_iso8601)
sDateTime_UTC_RFC7231 = *g_date_time_format (GDateTime_UTC_Base,Pattern_UTC_RFC7231)
' ----------------------------------------------------------------------------------------
'
' this print correct time-strings <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
'
' ----------------------------------------------------------------------------------------
Print "sDateTime_UTC_iso8601 = ";sDateTime_UTC_iso8601
Print "sDateTime_UTC_RFC7231 = ";sDateTime_UTC_RFC7231
' ----------------------------------------------------------------------------------------
Return 0
End Function
' .............................................................................................................................
' .............................................................................................................................
Type tagSourceAccess
iError As Long
iExtended As Long
iID As ULong
Name As ZString * 2048
DateTime_EPOCH As LongInt
DateTime_iso8601 As ZString * 128
DateTime_RFC7231 As ZString * 128
DateTime_GDateTime As GDateTime Ptr
Declare Function Import(iID As ULong) As Long
Declare Function Export() As Long
Declare Function Compare() As Long
Declare Function Setup() As Long
Declare Sub DebugPrint()
Declare Constructor()
Declare Constructor(ByRef tSourceAccess As tagSourceAccess)
Declare Operator Let (ByRef tSourceAccess As tagSourceAccess)
Declare Destructor ()
End Type
' .............................................................................................................................
Function tagSourceAccess.Import(iID As ULong) As Long
This.iID = iID
This.name = asGlobal(iID).name
This.DateTime_EPOCH = asGlobal(iID).DateTime_EPOCH
' ----------------------------------------------------------------------------------------
DateTimeParse_EPOCHToAll(This.DateTime_EPOCH, _
This.DateTime_iso8601, _
This.DateTime_RFC7231, _
This.DateTime_GDateTime)
' ----------------------------------------------------------------------------------------
'
' thes print blank time-strings <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
'
' ----------------------------------------------------------------------------------------
Print "sDateTime_UTC_iso8601 = ";This.DateTime_iso8601
Print "sDateTime_UTC_RFC7231 = ";This.DateTime_RFC7231
' ----------------------------------------------------------------------------------------
This.iError = SourceAccess_OK
This.iExtended = SourceAccess_ExtOK
' ----------------------------------------------------------------------------------------
Function = SourceAccess_OK
End Function
' .............................................................................................................................