#53597 - 08/29/01 11:03 AM
Zulu to Epoch
|
Stealth Member
Registered: 09/27/01
Posts: 33
|
Hey folks,
On a lighter note...
Has anyone tackled converting "Zulu" time to epoch? Okay I know Zulu is
synonymous with Greenwich Mean Time
(My apologies to the English who are reading this, I know that I just
probably butchered one of your city's names) , however, the folks who
run my LDAP server here like to store time in the format...
"200108280318Z" or "YYYYMMDDHHMMZ" which they refer to as "Zulu time".
Now I know that Perl has a timelocal() function which I could use, but
I'm not allowed to use Perl and I haven't found a C equivalent as of
yet. So any ideas would be GREATLY appreciated.
Thanks,
Scott
PS: I wanna kill the lame brain who decided to put Remedy on an NT box!
UNIX forever!!!! hahahaha
_____________________________
|
|
Top
|
|
|
|
|
#53598 - 08/29/01 11:46 AM
Re: Zulu to Epoch
[Re: daksionz]
|
Stealth Member
Registered: 06/12/01
Posts: 146
|
I know you have said you can't use PERL, but I've just written a PERL
routine to convert yyyy-mm-dd hh:mm:ss to seconds form the epoch. It is
just a bunch of constant values, and some maths, that could be built into
active links, I suppose.
If it is any use, I'm happy to share it.
Neil Anderson
Senior Systems Developer
Halifax plc (UK)
disturbed_work@yahoo.co.uk
disturbed_uk@yahoo.com
Mobile: 07785 372821
'This message is attributable to the sender and does not necessarily reflect
the view of Halifax Group plc or its subsidiaries'
----- Original Message -----
From: "Scott Glass"
To:
Sent: Wednesday, August 29, 2001 4:03 PM
Subject: Zulu to Epoch
> **
>
> Hey folks,
> On a lighter note...
>
> Has anyone tackled converting "Zulu" time to epoch? Okay I know Zulu is
> synonymous with Greenwich Mean Time
> (My apologies to the English who are reading this, I know that I just
> probably butchered one of your city's names) , however, the folks who
> run my LDAP server here like to store time in the format...
> "200108280318Z" or "YYYYMMDDHHMMZ" which they refer to as "Zulu time".
>
> Now I know that Perl has a timelocal() function which I could use, but
> I'm not allowed to use Perl and I haven't found a C equivalent as of
> yet. So any ideas would be GREATLY appreciated.
>
> Thanks,
> Scott
>
> PS: I wanna kill the lame brain who decided to put Remedy on an NT box!
> UNIX forever!!!! hahahaha
>
>
________________
_____________
>
> You may also control your subscription options, including UNSUBSCRIBE, at
www.ARSLIST.org
_____________________________
|
|
Top
|
|
|
|
|
#53599 - 08/29/01 12:14 PM
Re: Zulu to Epoch
[Re: daksionz]
|
Stealth Member
Registered: 06/13/01
Posts: 15
|
Isn't it just as easy to set a date/time field then have a piece of
workflow to take the date/time field value and set it into an integer field
to get the seconds.
-----Original Message-----
From: Neil Anderson
To: ARSLIST@LISTSERV.VISTAIT.COM
Sent: 8/29/01 10:46 AM
Subject: Re: Zulu to Epoch
**
I know you have said you can't use PERL, but I've just written a PERL
routine to convert yyyy-mm-dd hh:mm:ss to seconds form the epoch. It is
just a bunch of constant values, and some maths, that could be built
into
active links, I suppose.
If it is any use, I'm happy to share it.
Neil Anderson
Senior Systems Developer
Halifax plc (UK)
disturbed_work@yahoo.co.uk
disturbed_uk@yahoo.com
Mobile: 07785 372821
'This message is attributable to the sender and does not necessarily
reflect
the view of Halifax Group plc or its subsidiaries'
----- Original Message -----
From: "Scott Glass"
To:
Sent: Wednesday, August 29, 2001 4:03 PM
Subject: Zulu to Epoch
> **
>
> Hey folks,
> On a lighter note...
>
> Has anyone tackled converting "Zulu" time to epoch? Okay I know Zulu
is
> synonymous with Greenwich Mean Time
> (My apologies to the English who are reading this, I know that I just
> probably butchered one of your city's names) , however, the folks who
> run my LDAP server here like to store time in the format...
> "200108280318Z" or "YYYYMMDDHHMMZ" which they refer to as "Zulu time".
>
> Now I know that Perl has a timelocal() function which I could use, but
> I'm not allowed to use Perl and I haven't found a C equivalent as of
> yet. So any ideas would be GREATLY appreciated.
>
> Thanks,
> Scott
>
> PS: I wanna kill the lame brain who decided to put Remedy on an NT
box!
> UNIX forever!!!! hahahaha
>
>
____________
____
_____________
>
> You may also control your subscription options, including UNSUBSCRIBE,
at
www.ARSLIST.org
____________
_________________
You may also control your subscription options, including UNSUBSCRIBE,
at www.ARSLIST.org
_____________________________
|
|
Top
|
|
|
|
|
#53600 - 08/29/01 12:22 PM
Re: Zulu to Epoch
[Re: daksionz]
|
Stealth Member
Registered: 06/13/01
Posts: 81
|
You can actually do most time conversions in Perl one-liners (perl -e).
There are pretty good discussions of how to use built-in functions (no
math needed) or the readily avialable POSIX module.
Run "perldoc -f gmtime" to get started...
--Tim Widowfield,
taw@dnaco.net
On Wed, 29 Aug 2001, Neil Anderson wrote:
> **
>
> I know you have said you can't use PERL, but I've just written a PERL
> routine to convert yyyy-mm-dd hh:mm:ss to seconds form the epoch. It is
> just a bunch of constant values, and some maths, that could be built into
> active links, I suppose.
>
> If it is any use, I'm happy to share it.
>
>
>
> Neil Anderson
> Senior Systems Developer
> Halifax plc (UK)
>
> disturbed_work@yahoo.co.uk
> disturbed_uk@yahoo.com
>
> Mobile: 07785 372821
>
> 'This message is attributable to the sender and does not necessarily reflect
> the view of Halifax Group plc or its subsidiaries'
> ----- Original Message -----
> From: "Scott Glass"
> To:
> Sent: Wednesday, August 29, 2001 4:03 PM
> Subject: Zulu to Epoch
>
>
> > **
> >
> > Hey folks,
> > On a lighter note...
> >
> > Has anyone tackled converting "Zulu" time to epoch? Okay I know Zulu is
> > synonymous with Greenwich Mean Time
> > (My apologies to the English who are reading this, I know that I just
> > probably butchered one of your city's names) , however, the folks who
> > run my LDAP server here like to store time in the format...
> > "200108280318Z" or "YYYYMMDDHHMMZ" which they refer to as "Zulu time".
> >
> > Now I know that Perl has a timelocal() function which I could use, but
> > I'm not allowed to use Perl and I haven't found a C equivalent as of
> > yet. So any ideas would be GREATLY appreciated.
> >
> > Thanks,
> > Scott
> >
> > PS: I wanna kill the lame brain who decided to put Remedy on an NT box!
> > UNIX forever!!!! hahahaha
> >
> >
> ________________
> _____________
> >
>
> > You may also control your subscription options, including UNSUBSCRIBE, at
> www.ARSLIST.org
>
> _____________________________
>
>
>
_____________________________
|
|
Top
|
|
|
|
|
#53601 - 08/29/01 12:41 PM
Re: Zulu to Epoch
[Re: daksionz]
|
Stealth Member
Registered: 06/13/01
Posts: 81
|
So your not allowed to use Perl, huh? That's funny. Do you think they
told our ancestors, "Go dig a ditch, but don't use your favorite shovel"?
Are you on SQL Server, too? I suppose there are some D/T functions in
Transact SQL....
If it were me, I'd use Windows Scripting Host (cscript) and write a short
JScript program. This way, it's all Microsoft, all supported, all
"clean." Also, you don't need to fire up Visual C++ anytime you want to
tinker with it.
If you're interested, I have some code lying around that might help.
--Tim Widowfield,
taw@dnaco.net
On Wed, 29 Aug 2001, Scott Glass wrote:
> **
>
> Hey folks,
> On a lighter note...
>
> Has anyone tackled converting "Zulu" time to epoch? Okay I know Zulu is
> synonymous with Greenwich Mean Time
> (My apologies to the English who are reading this, I know that I just
> probably butchered one of your city's names) , however, the folks who
> run my LDAP server here like to store time in the format...
> "200108280318Z" or "YYYYMMDDHHMMZ" which they refer to as "Zulu time".
>
> Now I know that Perl has a timelocal() function which I could use, but
> I'm not allowed to use Perl and I haven't found a C equivalent as of
> yet. So any ideas would be GREATLY appreciated.
>
> Thanks,
> Scott
>
> PS: I wanna kill the lame brain who decided to put Remedy on an NT box!
> UNIX forever!!!! hahahaha
>
> _____________________________
>
>
>
_____________________________
|
|
Top
|
|
|
|
|
#53602 - 08/29/01 01:04 PM
Re: Zulu to Epoch
[Re: daksionz]
|
Stealth Member
Registered: 09/27/01
Posts: 33
|
Hey folks,
Thanks for the suggestions. Unfortunately, this is for the AREA/LDAP
interface. My LDAP folks store the Last Modified Time in Zulu format.
The AREAResponseStruct needs it in epoch. Since I have to write this in
C, I really need a C example.
I feel very much like a fish out of water without the use of Perl.
Fortunately I've had five years of schooling where all they had us do
was write C/C++ programs.
thanks again,
Scott
_____________________________
|
|
Top
|
|
|
|
|
#53603 - 08/29/01 02:15 PM
Re: Zulu to Epoch
[Re: daksionz]
|
Stealth Member
Registered: 09/27/01
Posts: 33
|
Hey folks,
See, given enough time, I can figure out everything! (Okay feel free
to roast)...
Anyway here's a C code snippit on how to convert Zulu to Epoch. (Don't
laugh, it works!)
long ZuluToEpoch(char* zulutime) {
struct tm date;
int counter = 0;
char zulu[5];
char *zptr;
zulu[4] = '\0';
zptr = zulutime;
// The string is stored in the format YYYYMMDDHHSSZ //
// We're going to parse it using pointer mathematics //
for(counter = 0; counter < 4; counter++) {
zulu[counter] = zptr[0];
zptr++;
}
date.tm_year = atoi(zulu) - 1900;
zulu[2] = '\0';
for(counter = 0; counter < 2; counter++) {
zulu[counter] = zptr[0];
zptr++;
}
date.tm_mon = atoi(zulu) - 1;
for(counter = 0; counter < 2; counter++) {
zulu[counter] = zptr[0];
zptr++;
}
date.tm_mday = atoi(zulu);
for(counter = 0; counter < 2; counter++) {
zulu[counter] = zptr[0];
zptr++;
}
date.tm_hour = atoi(zulu) - 1;
for(counter = 0; counter < 2; counter++) {
zulu[counter] = zptr[0];
zptr++;
}
date.tm_min = atoi(zulu);
date.tm_sec = 0;
// Why they call this mktime (Make time) I have no clue, but it
takes a tm struct //
// and converts it to it's epoch equivelent. I had to dig for
this one //
return (long)mktime(&date);
}
_____________________________
|
|
Top
|
|
|
|
|
|
|