Re: [O] Problem with Google Calendar Synchronization

2013-05-11 Thread Guido Van Hoecke
Hi Eric,

 Hang on, I am still looking into the UTC aspect.

 Right now the offset is dependent upon the execution time rather than
 upon the date being converted.

 Yes, if by execution time you mean by the time zone of the computer
 running the script.  This is definitely a problem and one which I gave
 up trying to solve.  Mind you, it did cause me no end of problems last
 year and this year again when I moved from the UK to Australia and then
 back again...

 What I meant is that running the script during winter time applies the
 winter time offset to all times, and running during summer time would
 apply the summer time offset to all times.

 As far as handling the tz difference between th file and the computer, I
 suggest to use a remote shell to a computer that has the same time zone
 as the file. The offsets will be different, and probably the switchover
 times too. Not something to handle in an awk script, I am afraid.

 Okay.  No rush from my point of view.  I would love to see a solution to
 this problem!

 The attached patch provides a solution. UTC times are corrected with the
 offset appropriate to that specific time. This will work for full hour
 offsets as well as offsets with any number of minutes (e.g. -0145,
 +0230). Still, this conversion uses the computer's time zone...


 I added some additional configuration options that allow for easy
 tailoring of the script's behaviour:

 # set to 1 or 0 to yes or not output a header block with TITLE,
 # AUTHOR, EMAIL etc...
 header = 1;

 # set to 1 or 0 to yes or not output the original ical preamble as
 # comment
 preamble = 1;

 # set to 1 to output time and summary as one line starting with
 # the time (value 1) or to 0 to output the summary as first line
 # and the date and time info as a second line
 condense = 0;

 # set to 1 or 0 to yes or not output the original ical entry as a
 # comment (mostly useful for debugging purposes)
 original = 1;

 # google truncates long subjects with ... which is misleading in
 # an org file: it gives the unfortunate impression that an
 # expanded entry is still collapsed; value 1 will trim those
 # ... and value 0 doesn't touch them
 trimdots = 0;

 # change this to your name
 author = Eric S Fraga

 # and to your email address
 emailaddress = e.fr...@ucl.ac.uk


 I left the default values to produce the output as you initially
 intended.

 I prefer to toggle preamble, condense, original and trimdots, but that
 is very subjective.

 With kind regards,


The attached patch replaces the one of my previous mail. It is to be
applied to the version that is available at
http://orgmode.org/worg/org-tutorials/org-google-sync.html

Until now the script generated a date string for both the start and end
times found in the ics file. This resulted in redundant data.

If the start and end time fall belong to the same day, the script will
now output one single date with a hyphen-separated time span, rather
than two individual (double-hyphen-separated) dates with resp. the start
date/time and the end date/time.

In the same spirit, when start and end date are 1 day apart and no time
info is present (birthdays, anniversaries etc.), only the start date
will be output. So it would output 2013-05-11 Sat rather than
2013-05-11 Sat 00:00--2013-05-12 Sun 00:00.

For dates before the epoch this would be 1913-05-11 rather than
1913-05-11 00:00--1913-05-12 00:00.

Have a nice weekend,


Guido

--
Computer programmers do it byte by byte.


--- ical2org.awk.orig	2013-05-09 14:15:14.0 +0200
+++ ical2org.awk	2013-05-11 16:46:37.0 +0200
@@ -9,9 +9,22 @@
 # Note: change org meta information generated below for author and
 # email entries!
 #
-# Known bugs:
-# - not so much a bug as a possible assumption: date entries with no time
-#   specified are assumed to be independent of the time zone.
+# Caveats:
+#
+# - date entries with no time specified are assumed to be local time zone;
+#   same remark for date entries that do have a time but do not end with Z
+#   e.g.: 20130101T123456 is local and will be kept as 2013-01-01 12:34
+#   where 20130223T123422Z is UTC and will be corrected appropriately
+#
+# - UTC times are changed into local times, using the time zone of the
+#   computer that runs the script; it would be very hard in an awk script
+#   to respect the time zone of a file belonging to another time zone:
+#   the offsets will be different as well as the switchover time(s);
+#   (consider a remote shell to a computer with the file's time zone)
+#
+# - the UTC conversion entirely relies on the built-in strftime method;
+#   the author is not responsible for any erroneous conversions nor the
+#   consequence of such conversions
 #
 # Eric S Fraga
 # 20100629 - initial version
@@ -27,101 +40,105 @@
 # no further revision log after this as the file was moved into a git
 # repository...
 #
-# Last change: 2011.01.28 16:08:03
+# 

Re: [O] Problem with Google Calendar Synchronization

2013-05-10 Thread Guido Van Hoecke
Eric,

Eric S Fraga e.fr...@ucl.ac.uk writes:

 Guido Van Hoecke gui...@gmail.com writes:


 [...]

 I have attached the corrected patch.

 I don't know whether I have access to Worg.
 Would you mind updating it?

 Okay; I'll try to do this early next week.

Hang on, I am still looking into the UTC aspect.

Right now the offset is dependent upon the execution time rather than
upon the date being converted.

I'll keep you posted.


Guido

--
NOTICE:
Anyone seen smoking will be assumed to be on fire and will
be summarily put out.



Re: [O] Problem with Google Calendar Synchronization

2013-05-10 Thread Eric S Fraga
Guido Van Hoecke gui...@gmail.com writes:

[...]

 Hang on, I am still looking into the UTC aspect.

 Right now the offset is dependent upon the execution time rather than
 upon the date being converted.

Yes, if by execution time you mean by the time zone of the computer
running the script.  This is definitely a problem and one which I gave
up trying to solve.  Mind you, it did cause me no end of problems last
year and this year again when I moved from the UK to Australia and then
back again...

 I'll keep you posted.

Okay.  No rush from my point of view.  I would love to see a solution to
this problem!

-- 
: Eric S Fraga, GnuPG: 0xC89193D8FFFCF67D
: in Emacs 24.3.50.1 and Org release_8.0.2-94-g5a1400




Re: [O] Problem with Google Calendar Synchronization

2013-05-10 Thread Guido Van Hoecke
Hi Eric,

 Guido Van Hoecke gui...@gmail.com writes:

 [...]

 Hang on, I am still looking into the UTC aspect.

 Right now the offset is dependent upon the execution time rather than
 upon the date being converted.

 Yes, if by execution time you mean by the time zone of the computer
 running the script.  This is definitely a problem and one which I gave
 up trying to solve.  Mind you, it did cause me no end of problems last
 year and this year again when I moved from the UK to Australia and then
 back again...

What I meant is that running the script during winter time applies the
winter time offset to all times, and running during summer time would
apply the summer time offset to all times.

As far as handling the tz difference between th file and the computer, I
suggest to use a remote shell to a computer that has the same time zone
as the file. The offsets will be different, and probably the switchover
times too. Not something to handle in an awk script, I am afraid.

 Okay.  No rush from my point of view.  I would love to see a solution to
 this problem!

The attached patch provides a solution. UTC times are corrected with the
offset appropriate to that specific time. This will work for full hour
offsets as well as offsets with any number of minutes (e.g. -0145,
+0230). Still, this conversion uses the computer's time zone...


I added some additional configuration options that allow for easy
tailoring of the script's behaviour:

# set to 1 or 0 to yes or not output a header block with TITLE,
# AUTHOR, EMAIL etc...
header = 1;

# set to 1 or 0 to yes or not output the original ical preamble as
# comment
preamble = 1;

# set to 1 to output time and summary as one line starting with
# the time (value 1) or to 0 to output the summary as first line
# and the date and time info as a second line
condense = 0;

# set to 1 or 0 to yes or not output the original ical entry as a
# comment (mostly useful for debugging purposes)
original = 1;

# google truncates long subjects with ... which is misleading in
# an org file: it gives the unfortunate impression that an
# expanded entry is still collapsed; value 1 will trim those
# ... and value 0 doesn't touch them
trimdots = 0;

# change this to your name
author = Eric S Fraga

# and to your email address
emailaddress = e.fr...@ucl.ac.uk


I left the default values to produce the output as you initially
intended.

I prefer to toggle preamble, condense, original and trimdots, but that
is very subjective.

With kind regards,

--- ical2org.awk.orig	2013-05-09 14:15:14.0 +0200
+++ ical2org.awk	2013-05-10 23:33:50.0 +0200
@@ -9,9 +9,22 @@
 # Note: change org meta information generated below for author and
 # email entries!
 #
-# Known bugs:
-# - not so much a bug as a possible assumption: date entries with no time
-#   specified are assumed to be independent of the time zone.
+# Caveats:
+#
+# - date entries with no time specified are assumed to be local time zone;
+#   same remark for date entries that do have a time but do not end with Z
+#   e.g.: 20130101T123456 is local and will be kept as 2013-01-01 12:34
+#   where 20130223T123422Z is UTC and will be corrected appropriately
+#
+# - UTC times are changed into local times, using the time zone of the
+#   computer that runs the script; it would be very hard in an awk script
+#   to respect the time zone of a file belonging to another time zone:
+#   the offsets will be different as well as the switchover time(s);
+#   (consider a remote shell to a computer with the file's time zone)
+#
+# - the UTC conversion entirely relies on the built-in strftime method;
+#   the author is not responsible for any erroneous conversions nor the
+#   consequence of such conversions
 #
 # Eric S Fraga
 # 20100629 - initial version
@@ -27,101 +40,105 @@
 # no further revision log after this as the file was moved into a git
 # repository...
 #
-# Last change: 2011.01.28 16:08:03
+# Last change: 2013.05.10 23:33:50
 #--

-# a function to take the iCal formatted date+time, convert it into an
-# internal form (seconds since time 0), and adjust according to the
-# local time zone (specified by +-UTC_offset calculated in the BEGIN
-# section)
+BEGIN {
+### config section

-function datetimestamp(input)
-{
-# convert the iCal Date+Time entry to a format that mktime can understand
+# maximum age in days for entries to be output: set this to -1 to
+# get all entries or to N0 to only get enties that start or end
+# less than N days ago
+max_age = -1;
+max_age =  7;
+
+# set to 1 or 0 to yes or not output a header block with TITLE,
+# AUTHOR, EMAIL etc...
+header = 1;
+
+# set to 1 or 0 to yes or not output the original ical preamble as
+# comment
+preamble = 1;
+
+# set to 1 to output time and summary as one 

Re: [O] Problem with Google Calendar Synchronization

2013-05-09 Thread Eric S Fraga
Guido Van Hoecke gui...@gmail.com writes:

[...]

 My ics file had a.o. my elder sister's birthday, and unfortunately her's
 as well as mine is (way) before the start of the epoch, so mktime
 returns a negative timestamp at line 63 and strftime at line 143 doesn't
 grok it.

Ah, I see.  The script should at least not break just because some of us
(me included) are older than Unix... ;-)

The fix should be straightforward.  Could you try adding the lines

   if (timestamp  0) timestamp = 0;

after the call to mktime in the datetimestamp function?  This should at
least make the script not crap out although obviously the date will be
wrong (set to start of epoch).  If this works, I will update the script
on Worg and put in a warning message of some sort, maybe even in the
entry itself.

Suggestions on how to handle this case would be welcome, of course.

-- 
: Eric S Fraga, GnuPG: 0xC89193D8FFFCF67D
: in Emacs 24.3.50.1 and Org release_8.0.2-68-g40635b




Re: [O] Problem with Google Calendar Synchronization

2013-05-09 Thread Guido Van Hoecke
Eric,

Eric S Fraga e.fr...@ucl.ac.uk writes:

 Guido Van Hoecke gui...@gmail.com writes:

 [...]

 My ics file had a.o. my elder sister's birthday, and unfortunately her's
 as well as mine is (way) before the start of the epoch, so mktime
 returns a negative timestamp at line 63 and strftime at line 143 doesn't
 grok it.

 Ah, I see.  The script should at least not break just because some of us
 (me included) are older than Unix... ;-)

 The fix should be straightforward.  Could you try adding the lines

if (timestamp  0) timestamp = 0;

 after the call to mktime in the datetimestamp function?  This should at
 least make the script not crap out although obviously the date will be
 wrong (set to start of epoch).  If this works, I will update the script
 on Worg and put in a warning message of some sort, maybe even in the
 entry itself.

With this change the script assigns the wrong date, but no longer stops.

 Suggestions on how to handle this case would be welcome, of course.

I created a patch so that the date and time string is built directly
from the iCal data for times before the epoch. This function produces
valid date/time strings albeit without weekday info.

Patch file is attached.

--- ical2org.awk.orig	2013-05-09 14:15:14.0 +0200
+++ ical2org.awk	2013-05-09 15:11:44.0 +0200
@@ -27,7 +27,7 @@
 # no further revision log after this as the file was moved into a git
 # repository...
 #
-# Last change: 2011.01.28 16:08:03
+# Last change: 2013.05.09 15:11:44
 #--

 # a function to take the iCal formatted date+time, convert it into an
@@ -60,12 +60,31 @@

 # print adjusted:  timestamp
 # print Time stamp  :  strftime(%Y-%m-%d %H:%M, timestamp);
+if(timestamp  0) timestamp = 0;
 return timestamp;
 }

+# a function to comvert the iCal date+time string into a date time string;
+# it uses the datetimestamp subroutine to compute the value to feed to strftime;
+# if the iCal date falls before time 0, the string is built from the iCal input;
+
+function datetimestring(input)
+{
+# try to create datetimestring from the datetimestamp
+timestamp = datetimestamp(input);
+if (timestamp  0)
+return strftime(%Y-%m-%d %a %H:%M, datetimestamp(datetmp));
+
+# this is a date before the start of the epoch
+# create the -mm-dd hh:mm string from the input (without day of week)
+datespec = gensub(([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])T([0-9][0-9])([0-9][0-9])([0-9][0-9]).*[\r]*, \\1-\\2-\\3 \\4:\\5, g, input);
+# print == datespec: datespec;
+return datespec;
+}
+
 BEGIN {
 ### config section
-max_age =  7; # in days
+max_age =  -1; #7; # in days
   # set this to -1 to get all entries or to N0 to only get
   # that start or end less than N days ago
 ### end config section
@@ -90,6 +109,7 @@
 indescription = 0;
 lasttimestamp=-1;

+
 print #+TITLE: Main Google calendar entries
 print #+AUTHOR:Eric S Fraga
 print #+EMAIL: e.fr...@ucl.ac.uk
@@ -140,12 +160,12 @@

 /^DTSTART;VALUE=DATE/ {
 datetmp = gensub(([0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9])(.*[\r]), \\1T00\\2, g, $2)
-date = strftime(%Y-%m-%d %a %H:%M, datetimestamp(datetmp));
+date = datetimestring(datetmp);
 if(max_age0) lasttimestamp = datetimestamp(datetmp);
 }
 /^DTEND;VALUE=DATE/ {
 datetmp = gensub(([0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9])(.*[\r]), \\1T00\\2, g, $2)
-time2 = strftime(%Y-%m-%d %a %H:%M, datetimestamp(datetmp));
+time2 = datetimestring(datetmp);
 date = date -- time2;
 if(max_age0) lasttimestamp = datetimestamp(datetmp);
 }
@@ -154,7 +174,7 @@
 # we ignore the seconds

 /^DTSTART[:;][^V]/ {
-date = strftime(%Y-%m-%d %a %H:%M, datetimestamp($2));
+date = datetimestring($2);
 if(max_age0) lasttimestamp = datetimestamp($2);
 # print date;
 }
@@ -165,7 +185,7 @@

 /^DTEND[:;][^V]/ {
 # print $0
-time2 = strftime(%Y-%m-%d %a %H:%M, datetimestamp($2));
+time2 = datetimestring($2);
 date = date -- time2;
 if(max_age0) lasttimestamp = datetimestamp($2);
 }

Kind regards,


Guido

--
Accident:
A condition in which presence of mind is good,
but absence of body is better.
-- Foolish Dictionary


Re: [O] Problem with Google Calendar Synchronization

2013-05-09 Thread Eric S Fraga
Guido Van Hoecke gui...@gmail.com writes:

 Eric,

 Eric S Fraga e.fr...@ucl.ac.uk writes:

[...]

 Suggestions on how to handle this case would be welcome, of course.

 I created a patch so that the date and time string is built directly
 from the iCal data for times before the epoch. This function produces
 valid date/time strings albeit without weekday info.

 Patch file is attached.

Excellent.  Thanks for this.  Can you update the file on Worg directly?
If not, I will try to do it.

One point, however.  Should the first return statement in your
datetimestring(input) function (see last line in patch excerpt below)
refer to input instead of datetmp?  What you have works because of
all variables being global but is less clear than using the argument, I
would suggest?

 +function datetimestring(input)
 +{
 +# try to create datetimestring from the datetimestamp
 +timestamp = datetimestamp(input);
 +if (timestamp  0)
 +return strftime(%Y-%m-%d %a %H:%M, datetimestamp(datetmp));

Thanks again,
eric

-- 
: Eric S Fraga, GnuPG: 0xC89193D8FFFCF67D
: in Emacs 24.3.50.1 and Org release_8.0.2-101-gce5988




Re: [O] Problem with Google Calendar Synchronization

2013-05-09 Thread Guido Van Hoecke
Hi Eric,

Eric S Fraga e.fr...@ucl.ac.uk writes:

 Guido Van Hoecke gui...@gmail.com writes:

 Eric,

 Eric S Fraga e.fr...@ucl.ac.uk writes:

 [...]

 Suggestions on how to handle this case would be welcome, of course.

 I created a patch so that the date and time string is built directly
 from the iCal data for times before the epoch. This function produces
 valid date/time strings albeit without weekday info.

 Patch file is attached.

 Excellent.  Thanks for this.  Can you update the file on Worg directly?
 If not, I will try to do it.

 One point, however.  Should the first return statement in your
 datetimestring(input) function (see last line in patch excerpt below)
 refer to input instead of datetmp?  What you have works because of
 all variables being global but is less clear than using the argument, I
 would suggest?

It should be timestamp rather than datetmp :(

I have attached the corrected patch.

I don't know whether I have access to Worg.
Would you mind updating it?

 Thanks again,

My pleasure,
--- ical2org.awk.orig	2013-05-09 14:15:14.0 +0200
+++ ical2org.awk	2013-05-09 19:52:37.0 +0200
@@ -27,7 +27,7 @@
 # no further revision log after this as the file was moved into a git
 # repository...
 #
-# Last change: 2011.01.28 16:08:03
+# Last change: 2013.05.09 19:52:37
 #--

 # a function to take the iCal formatted date+time, convert it into an
@@ -60,12 +60,31 @@

 # print adjusted:  timestamp
 # print Time stamp  :  strftime(%Y-%m-%d %H:%M, timestamp);
+if(timestamp  0) timestamp = 0;
 return timestamp;
 }

+# a function to comvert the iCal date+time string into a date time string;
+# it uses the datetimestamp subroutine to compute the value to feed to strftime;
+# if the iCal date falls before time 0, the string is built from the iCal input;
+
+function datetimestring(input)
+{
+# try to create datetimestring from the datetimestamp
+timestamp = datetimestamp(input);
+if (timestamp  0)
+return strftime(%Y-%m-%d %a %H:%M, datetimestamp(timestamp));
+
+# this is a date before the start of the epoch
+# create the -mm-dd hh:mm string from the input (without day of week)
+datespec = gensub(([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])T([0-9][0-9])([0-9][0-9])([0-9][0-9]).*[\r]*, \\1-\\2-\\3 \\4:\\5, g, input);
+# print == datespec: datespec;
+return datespec;
+}
+
 BEGIN {
 ### config section
-max_age =  7; # in days
+max_age =  -1; #7; # in days
   # set this to -1 to get all entries or to N0 to only get
   # that start or end less than N days ago
 ### end config section
@@ -90,6 +109,7 @@
 indescription = 0;
 lasttimestamp=-1;

+
 print #+TITLE: Main Google calendar entries
 print #+AUTHOR:Eric S Fraga
 print #+EMAIL: e.fr...@ucl.ac.uk
@@ -140,12 +160,12 @@

 /^DTSTART;VALUE=DATE/ {
 datetmp = gensub(([0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9])(.*[\r]), \\1T00\\2, g, $2)
-date = strftime(%Y-%m-%d %a %H:%M, datetimestamp(datetmp));
+date = datetimestring(datetmp);
 if(max_age0) lasttimestamp = datetimestamp(datetmp);
 }
 /^DTEND;VALUE=DATE/ {
 datetmp = gensub(([0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9])(.*[\r]), \\1T00\\2, g, $2)
-time2 = strftime(%Y-%m-%d %a %H:%M, datetimestamp(datetmp));
+time2 = datetimestring(datetmp);
 date = date -- time2;
 if(max_age0) lasttimestamp = datetimestamp(datetmp);
 }
@@ -154,7 +174,7 @@
 # we ignore the seconds

 /^DTSTART[:;][^V]/ {
-date = strftime(%Y-%m-%d %a %H:%M, datetimestamp($2));
+date = datetimestring($2);
 if(max_age0) lasttimestamp = datetimestamp($2);
 # print date;
 }
@@ -165,7 +185,7 @@

 /^DTEND[:;][^V]/ {
 # print $0
-time2 = strftime(%Y-%m-%d %a %H:%M, datetimestamp($2));
+time2 = datetimestring($2);
 date = date -- time2;
 if(max_age0) lasttimestamp = datetimestamp($2);
 }


Guido

--
Life is like a buffet; it's not good but there's plenty of it.


Re: [O] Problem with Google Calendar Synchronization

2013-05-09 Thread Eric S Fraga
Guido Van Hoecke gui...@gmail.com writes:


[...]

 I have attached the corrected patch.

 I don't know whether I have access to Worg.
 Would you mind updating it?

Okay; I'll try to do this early next week.
-- 
: Eric S Fraga, GnuPG: 0xC89193D8FFFCF67D
: in Emacs 24.3.50.1 and Org release_8.0.2-101-gce5988




Re: [O] Problem with Google Calendar Synchronization

2013-05-08 Thread Eric S Fraga
Guido Van Hoecke gui...@gmail.com writes:

 Hi,

 Thank you guys for your help.

 Got gawk from macports.

Glad you got it.  I did make use of whatever GNU awk provided and did
not try to keep to vanilla awk.  Sorry about that!

 Hitting data error now:

 gawk: ./importGoogleCalendar.awk:143: (FILENAME=- FNR=34026) fatal:
 strftime: second argument less than 0 or too big for time_t

 I am investigating this now and will report my findings

Keep us posted.  I've not seen this error before but I am not confident
that the parsing of date and time stamps in the awk script is
comprehensive.  If you don't track it down, I would be happy to look at
your calendar file.

-- 
: Eric S Fraga, GnuPG: 0xC89193D8FFFCF67D
: in Emacs 24.3.50.1 and Org release_8.0.2-68-g40635b




Re: [O] Problem with Google Calendar Synchronization

2013-05-08 Thread Guido Van Hoecke
Eric S Fraga e.fr...@ucl.ac.uk writes:

 Guido Van Hoecke gui...@gmail.com writes:

 Hi,

 Thank you guys for your help.

 Got gawk from macports.

 Glad you got it.  I did make use of whatever GNU awk provided and did
 not try to keep to vanilla awk.  Sorry about that!

No prob at all!

 Hitting data error now:

 gawk: ./importGoogleCalendar.awk:143: (FILENAME=- FNR=34026) fatal:
 strftime: second argument less than 0 or too big for time_t

 I am investigating this now and will report my findings

 Keep us posted.  I've not seen this error before but I am not confident
 that the parsing of date and time stamps in the awk script is
 comprehensive.  If you don't track it down, I would be happy to look at
 your calendar file.

There's no error in the script :)

My ics file had a.o. my elder sister's birthday, and unfortunately her's
as well as mine is (way) before the start of the epoch, so mktime
returns a negative timestamp at line 63 and strftime at line 143 doesn't
grok it.

Anyway, I don't need these records as I have them in a separate
anniversaries.org file that uses diary-style sexp entries for the
birthdays.

So Eric, rest assured, the script works fine for events occurring since
the start of the epoch. It was quite a help to me.

Thanks for your effort and for sharing it,


Guido

--
APL is a write-only language.  I can write programs
in APL, but I can't read any of them.
-- Roy Keir



Re: [O] Problem with Google Calendar Synchronization

2013-05-07 Thread Tassilo Horn
Guido Van Hoecke gui...@gmail.com writes:

Hu Giudo,

 When executing the awk script written by Eric S. Fraga at
 http://orgmode.org/worg/org-tutorials/org-google-sync.html I get
 following error:

 /usr/bin/awk: calling undefined function gensub
  source line number 82

 This is on an iMac with 'awk version 20070501'.

 Is this outdated or so?

gensub is a GNU awk extension.  So either you are running a different
flavor of awk, or you are running it in compatibility mode (Option -c or
--traditional).  Given the version string, I guess it's another flavor.

--8---cut here---start-8---
% awk -V
GNU Awk 4.0.2
Copyright (C) 1989, 1991-2012 Free Software Foundation.
--8---cut here---end---8---

Bye,
Tassilo




Re: [O] Problem with Google Calendar Synchronization

2013-05-07 Thread Henning Weiss
Hi,

On Tue, May 7, 2013 at 12:26 PM, Tassilo Horn t...@gnu.org wrote:

 Guido Van Hoecke gui...@gmail.com writes:

 Hu Giudo,

  When executing the awk script written by Eric S. Fraga at
  http://orgmode.org/worg/org-tutorials/org-google-sync.html I get
  following error:
 
  /usr/bin/awk: calling undefined function gensub
   source line number 82
 
  This is on an iMac with 'awk version 20070501'.
 
  Is this outdated or so?

 gensub is a GNU awk extension.  So either you are running a different
 flavor of awk, or you are running it in compatibility mode (Option -c or
 --traditional).  Given the version string, I guess it's another flavor.


The easiest way to get GNU awk on mac is probably to install
homebrewhttp://mxcl.github.io/homebrew/(or
macports http://www.macports.org/) first. In case of homebrew you can run:

ruby -e $(curl -fsSL https://raw.github.com/mxcl/homebrew/go)
brew update
brew install gawk

regards,
Henning


Re: [O] Problem with Google Calendar Synchronization

2013-05-07 Thread Guido Van Hoecke
Hi,

Thank you guys for your help.

Got gawk from macports.

Hitting data error now:

gawk: ./importGoogleCalendar.awk:143: (FILENAME=- FNR=34026) fatal:
strftime: second argument less than 0 or too big for time_t

I am investigating this now and will report my findings


Guido.


On 7 May 2013 15:04, Henning Weiss hdwe...@gmail.com wrote:
 Hi,

 On Tue, May 7, 2013 at 12:26 PM, Tassilo Horn t...@gnu.org wrote:

 Guido Van Hoecke gui...@gmail.com writes:

 Hu Giudo,

  When executing the awk script written by Eric S. Fraga at
  http://orgmode.org/worg/org-tutorials/org-google-sync.html I get
  following error:
 
  /usr/bin/awk: calling undefined function gensub
   source line number 82
 
  This is on an iMac with 'awk version 20070501'.
 
  Is this outdated or so?

 gensub is a GNU awk extension.  So either you are running a different
 flavor of awk, or you are running it in compatibility mode (Option -c or
 --traditional).  Given the version string, I guess it's another flavor.


 The easiest way to get GNU awk on mac is probably to install homebrew (or
 macports) first. In case of homebrew you can run:

 ruby -e $(curl -fsSL https://raw.github.com/mxcl/homebrew/go)
 brew update
 brew install gawk

 regards,
 Henning