added copyright addergit st

This commit is contained in:
Radu Ioan Fericean
2012-02-29 14:35:28 +02:00
parent 2aa4cde569
commit 0bd20b3a22
5 changed files with 63 additions and 0 deletions

17
copyright_header.txt Normal file
View File

@@ -0,0 +1,17 @@
/*
Rating system designed to be used in VoIP Carriers World
Copyright (C) 2012 Radu Ioan Fericean
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
*/

24
header.sh Executable file
View File

@@ -0,0 +1,24 @@
# check for arguments
if [ $# -ne 1 ]
then
echo "Error in $0 - Invalid Argument Count"
echo "Syntax: $0 input_file - copyright header file"
exit
fi
# check for header file
infile=$1
if [ ! -f $infile ]
then
echo "Input file [$infile] not found - Aborting"
exit
fi
# inject header
for i in *.go
do
if ! grep -q Copyright $i
then
cat $infile $i >$i.new && mv $i.new $i
fi
done

View File

@@ -72,6 +72,7 @@ func (ap *ActivationPeriod) restore(input string) {
elements := strings.Split(input, ";")
unixNano, _ := strconv.ParseInt(elements[0], 10, 64)
ap.ActivationTime = time.Unix(0, unixNano).In(time.UTC)
ap.Intervals = make([]*Interval, 0)
for _, is := range elements[1 : len(elements)-1] {
i := &Interval{}
ise := strings.Split(is, "|")

View File

@@ -74,9 +74,30 @@ func TestApStoreRestore(t *testing.T) {
}
}
/**************************** Benchmarks *************************************/
func BenchmarkActivationPeriodRestore(b *testing.B) {
ap := ActivationPeriod{}
for i := 0; i < b.N; i++ {
ap.restore("1328106601;2|1|3,4|14:30:00|15:00:00|0|0|0|0;")
}
}
func BenchmarkActivationPeriodStoreRestore(b *testing.B) {
b.StopTimer()
d := time.Date(2012, time.February, 1, 14, 30, 1, 0, time.UTC)
i := &Interval{Month: time.February,
MonthDay: 1,
WeekDays: []time.Weekday{time.Wednesday, time.Thursday},
StartTime: "14:30:00",
EndTime: "15:00:00"}
ap := &ActivationPeriod{ActivationTime: d}
ap.AddInterval(i)
ap1 := ActivationPeriod{}
b.StartTimer()
for i := 0; i < b.N; i++ {
result := ap.store()
ap1.restore(result)
}
}

Binary file not shown.