#now()

DESCRIPTION
    returns the current time value (number of seconds since the Unix Epoch, January 1, 1970)
SYNOPSIS
    #now()
ARGUMENTS
    none
EXAMPLES
nowdst          // the current time, #now(), adjusted for Daylight Savings Time
                #now()
#ifdef dst
                       + 3600
#endifdef
fileage(F)      #trunc((#now()-#filemtime((F)))/=secs_in_day)
remind(Y, M, D, MSG)
                // send out a reminder message beginning at a certain date
                // (Y) is the year (e.g., 2007)
                // (M) is the month (e.g., 7)
                // (D) is the date (e.g., 15)
                // (MSG) is the message (e.g., "REVIEW DISK QUOTAS")
                if #now() > #datevalue((Y), (M), (D))
                        output mail (MSG)
                fi
page(M, R, H)   // send a page message (M) to recipients (pager phone alias)
                // (R) but only during hours (H), and only if =etcdir/nopage
                // and tmp/nopage don't exist (i.e., 'touch /pikt/etc/nopage'
                // or 'touch /tmp/nopage' will block all paging)
                // sample use:  =page($host is sick/down, =pagesysadmins, =allhours(#now()))
                if ! -e "=etcdir/nopage" && ! -e "/tmp/nopage"
                        if (H)
                                exec wait "=echo '(M)' | =mailx -a 'From: piktadmin' -s '(M)' (R)"
#if piktmaster
                                =shout((M), =always)
#endif
                        fi
                fi
periodically(A1, A2, M)
                        set #tv = #now()
                        if ! #defined(%tv) || (#tv - %tv >= (M)*60 - =driftfactor)
                                (A1)
                        else
                                (A2)
                                set #tv = %tv
                        fi

hourly(A1, A2)
                        set #tv60 = #now()
                        if ! #defined(%tv60) || (#tv60 - %tv60 >= 60*60 - =driftfactor)
                                (A1)
                        else
                                (A2)
                                set #tv60 = %tv60
                        fi
archive_mail_file(U, M)         // archive a user's mail file
                                // (U) is the user (e.g., $user)
                                // (M) is whether or not to output mail
                                //     (e.g., #true())
                                if -e "/var/mail/(U)"
                                        set $mailarcfile =  "/var/mail/arc/(U)" . "." . $text(#now())
                                        =execwait "=cp -p /var/mail/(U) $mailarcfile"
                                        if (M)
                                                output mail "saved user mail file as $mailarcfile"
                                                output mail $command("=ll $mailarcfile")
                                        fi
                                fi
                                if -e "/var/mail/." . (U) . ".pop"
                                        // #now()+1 to guarantee no conflict
                                        // with the preceding cp
                                        set $mailarcfile = "/var/mail/arc/(U)" . "." . $text(#now()+1)
                                        =execwait "=cp -p /var/mail/." . (U) . ".pop $mailarcfile"
                                        if (M)
                                                output mail "saved user mail file as $mailarcfile"
                                                output mail $command("=ll $mailarcfile")
                                        fi
                                fi
SEE ALSO
    #hour()
    #minute()
    #second()
    #today()
    #datevalue()
    #timevalue()

    Numerical Functions
    String Functions
 
Home | FAQ | News | Intro | Samples | Tutorial | Reference | Software
Developer's Notes | Licensing | Authors | Pikt-Users | Pikt-Workers | Related Projects | Site Index | Privacy Policy | Contact Us
Page best viewed at 1024x768 or greater.   Page last updated 2008-03-27.   This site is PIKT® powered.
PIKT® is a registered trademark of the University of Chicago.   Copyright © 1998-2008 Robert Osterlund. All rights reserved.
Home FAQ News Intro Samples Tutorial Reference Software
PIKT Logo
PIKT Page Title
View sample
PIKT defines